WP_Query options no longer work in MB Relationships 1.10.1

Support MB Relationships WP_Query options no longer work in MB Relationships 1.10.1Resolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #20672
    Paul WenzelPaul Wenzel
    Participant

    My site has a reciprocal relationship configured with episodes belonging to podcasts (custom post types created with Meta Box).

    After the release of MB Relationships 1.10.1, episodes failed to return in the correct order in my template. No matter what parameters are supplied to WP_Query, results always come back ordered by post date ascending. Passing order, orderby, or suppress_filters to WP_Query had no effect. Did something change in 1.10.1 that I need to adjust for?

    Reverting to MB Relationships 1.10.0 corrected the issue, but now we're frozen at that version, and upgrading seems impossible until that is resolved.

    I noticed a number of changes following the pull request in this thread. Might they be related?

    https://support.metabox.io/topic/reciprocal-relationships-do-not-follow-the-order-of-the-admin/

    Here's some sample code from my project:

    <?php // setup relationship 
    function podcasts_to_episodes_relationship () {
      MB_Relationships_API::register( array(
        'id' => 'podcasts_to_episodes',
        'reciprocal' => true,
        'from' => array(
          'object_type'  => 'post',
          'post_type'    => 'episode',
          'admin_column' => true,
          'meta_box'     => [
            'title' => 'Podcast',
          ],
        ),
        'to' => array(
          'object_type'  => 'post',
          'post_type'    => 'podcast',
          'admin_column' => false,
        ),
      ));
    }
    <?php // query for episodes belonging to a podcast
    
    $connected = new WP_Query( [
      'relationship' => [
        'id'   => 'podcasts_to_episodes',
        'from' => get_the_ID()
      ]
    ])

    Thanks!

    #20697
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please update the plugin MB Relationships to v1.10.3 or MB AIO to v1.11.15 to fix this issue. Thank you.

    #20709
    Paul WenzelPaul Wenzel
    Participant

    This update appears to have fixed the issue. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.