Custom Fields
Support Meta Box Conditional Logic How to hide group field when post field is empty?

  • Creator
  • #8391
    Resolved fexy


    What is the syntax for hiding a (group) field when another field (type='post') is null?

    I've tried several different variations like this on my group field:

    'hidden' => array('post', '!=', null),

    where 'post' is the metabox id of a sibling field. e.g.:

    'name' => __('Post'),
    'id' => 'post',
    'type' => 'post',
    'field_type' => 'select_advanced',
    'post_type' => array('recipe', 'post'),
    'placeholder' => 'Select post',
    'desc' => 'A recipe or post that appears in the list.'
Viewing 1 replies (of 1 total)
  • Author
  • #8409
    Anh Tran

    Hi, the problem is your post field ID. On the editing screen, the #post is used for the post form, so you can't use ID post. You need to change the ID of the post field.

    Then, you can hide the group if the field is null with this condition:

    'hidden' => array( 'post2', '=', '' ), // post2 is post field ID.

    PS: Please renew your license to get updates of extensions and support.

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