Custom Fields
Re-Envisioned
Support MB Relationships Code Snippet Error in KB?

  • Creator
    Topic
  • #11139
    Resolved @mindspark
    Participant

    I was trying to use the code snippet below which is displayed at https://docs.metabox.io/extensions/mb-relationships/

    and when I wrap it to make a function

    add_action( 'mb_relationships_init', function() {
    MB_Relationships_API::register( array(
        'id'   => 'posts_to_pages',
        'from' => array(
            'object_type'  => 'post',
            'admin_column' => 'true',  // THIS!
        ),
        'to'   => array(
            'object_type'  => 'post',
            'post_type'    => 'page',
            'admin_column' => 'after title', // THIS!
    ) );
    } );

    there is a syntax error – I don’t know how to close the script properly. since all of the other snippets work perfectly, I thought I would bring this to your attention.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #11149
    Anh Tran
    Keymaster

    Thanks a lot! I’ve just fixed it. It should be:

    MB_Relationships_API::register( array(
        'id'   => 'posts_to_pages',
        'from' => array(
            'object_type'  => 'post',
            'admin_column' => 'true',  // THIS!
        ),
        'to'   => array(
            'object_type'  => 'post',
            'post_type'    => 'page',
            'admin_column' => 'after title', // THIS!
        ),
    ) );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.