Custom Fields
Support MB Relationships Basic post type relationship dont work.

  • Creator
  • #9454
    Resolved manGometa

    Hi, Im trying MB relationships plugin but after many hours I still cant use it. In WP-admin is everything OK, but when I try to query posts from template its failed. Can you take look at this bug? Its really flustrating and usseless now.


    add_action( 'mb_relationships_init', function() {
        MB_Relationships_API::register( array(
            'id'   => 'articlebanner_to_articles',
            'from'   => 'm_articlebanner',
            'to'   => 'blog_article'
        ) );
    } );

    Query function:

    function getPostBanner(){
        $connected = new WP_Query( array(
            'post_type' => 'm_articlebanner',
          'relationship' => array(
              'id' => 'articlebanner_to_articles',
              'to' => 3798,
          'nopaging' => true
        ) );
        return $connected;

    DB records:

    Thanks for help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #9464
    Anh Tran

    Hello, the query to get connected posts seems to be ok. What error did you see? Can you please post the code that you use it and see it failed?


    I didnt see any error, but WP_Query return no posts. If I remove relationship array from WP_Query everything is ok and query return all posts.

    This is query from database, where are posts with same post_type and published:

    Anh Tran


    I've just did a similar test and it works for me. Do you have any filter/code that change the query? Some kind of hooks to pre_get_posts, query_vars, etc.?

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