Code Snippet Error in KB?

Support MB Relationships Code Snippet Error in KB?Resolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #11139
    @mindspark@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.

    #11149
    Anh TranAnh 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 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.