Get the terms doesn't work in admin after update

Support General Get the terms doesn't work in admin after update

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4523
    InternativeInternative
    Participant

    In the rwmb_meta_boxes filter I use the get_the_terms function. After a update from Meta Box 4.8.7 to 4.9.8 this doesn't work anymore. Is there a another solution to use get_the_terms in the rwmb_meta_boxes filter? Or will it be added back to the new update?

    #4530
    Anh TranAnh Tran
    Keymaster

    I guess you probably add filter too soon, when the get_the_terms function doesn't exists. You might want to change your code to something like:

    add_action( 'after_setup_theme', function() {
        add_filter( 'rwmb_meta_boxes', 'prefix_register_meta_boxes' );
    } );

    This way, your function runs at after_setup_theme where all WP functions are available.

    #4545
    InternativeInternative
    Participant

    Unfortunately this doesn't work. It will display this error.

    object(WP_Error)#10221 (2) { ["errors"]=> array(1) { ["invalid_taxonomy"]=> array(1) { [0]=> string(20) "Invalid Taxonomy." } } ["error_data"]=> array(0) { } }

    And in a action like genesis_before_content it will display the right terms.

    #4559
    Anh TranAnh Tran
    Keymaster

    Maybe try replacing the code above with:

    add_action( 'init', function() {
        add_filter( 'rwmb_meta_boxes', 'prefix_register_meta_boxes' );
    }, 5 );

    And check the code to register terms, make sure it's hooked into init with priority 0, like this:

    add_action( 'init', 'prefix_register_tax', 0 );

    #4586
    InternativeInternative
    Participant

    That worked! Thanks, for the support.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Get the terms doesn't work in admin after update’ is closed to new replies.