is_child not working as expected

Support MB Show Hide is_child not working as expected

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2180
    doughjdoughj
    Participant

    My metabox array is setup like this:

    $meta_boxes[] = array(
    		'id'         => 'client',
    		'title'      => __( 'Client Fields', 'vwh' ),
    		'post_types' => 'client',
    		'context'    => 'normal',
    		'priority'   => 'high',
    		'autosave'   => true,
        'exclude' => array('is_child'=>true),
        'hide' => array('is_child'=>true),
    		// List of meta fields
    		'fields'     => array(

    The exclude is working, but the hide is not. I tried "input_value" as well but that didn't work either, it is a custom post type.

    #2184
    Anh TranAnh Tran
    Keymaster

    Hi,

    Are you using both exclude and hide at the same time? If exclude rule is there, then meta box is not outputted in the page and thus, the hide rule doesn't work.

    #2186
    doughjdoughj
    Participant

    Right, but when it's a new page and it is not yet a child the exclude doesn't take affect.

    That's the specific use case. You've created a new post that will become a child so let's remove the fields you don't need.

    #2192
    Anh TranAnh Tran
    Keymaster

    I see. In this specific case, the new post hasn't been a child yet, so both exclude and hide couldn't detect that. So the rules couldn't work.

    I will think more about this specific case between add new post and edit an existing post. This probably is the same as this problem.

    #2194
    doughjdoughj
    Participant

    But isn't hide supposed to change things when form elements are updated before it's saved? Wouldn't that work here? I also tried the input_value method and it didn't work.

    #2195
    Anh TranAnh Tran
    Keymaster

    Ah, I see. Probably a bug with the Show/Hide extension. I will fix it to support "live" change.

    #2196
    Anh TranAnh Tran
    Keymaster

    I've just updated the Show/Hide extension. is_child is working as expected. Please update and check it.

    Thanks.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘is_child not working as expected’ is closed to new replies.