Title: Conditional Field Groups &#8211; Feature Request
Last modified: November 5, 2025

---

# Conditional Field Groups – Feature Request

 *  Resolved [one3rdnerd](https://wordpress.org/support/users/one3rdnerd/)
 * (@one3rdnerd)
 * [5 months, 1 week ago](https://wordpress.org/support/topic/conditional-field-groups-feature-request/)
 * It would be great if we could add a new field group for pages and then set some
   conditional settings, so it only shows if the parent is X or some other conditions
   are met. That way it would keep the edit screen for pages tidier and only show
   a specific meta box if needed.
 * For example, I create a new field group for “Case Studies” but Case Studies are
   only used on Industry pages, which all have the parent page “Industries”.
 * This sites arbitrarily on all pages and the user has to remember it doesn’t do
   anything unless the parent page is “Industries”.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [pdclark](https://wordpress.org/support/users/pdclark/)
 * (@pdclark)
 * [4 months, 1 week ago](https://wordpress.org/support/topic/conditional-field-groups-feature-request/#post-18738793)
 *     ```wp-block-code
       <?php/** * Plugin Name: Hide Fields if not Industries */add_action(    'admin_head',    function(){        // Are we not editing a post / page?        if (            ! array_key_exists( 'post', $_GET )            || ! array_key_exists( 'action', $_GET )        ) {            // Don't do anything.            return;        }        // Is the parent slug not 'industries'?        $parent = get_post(            get_post( $_GET['post'] )->parent        );        if (            'industries' !== $parent->post_name        ) {            // Don't do anything.            return;        }        ?><style>/* Hide a specific field named "field-name" */.pods-form-ui-row-name-field-name,/* Hide a field group named "more-fields" */#pods-meta-more-fields{    display: none;}</style>        <?php    });
       ```
   
 *  Thread Starter [one3rdnerd](https://wordpress.org/support/users/one3rdnerd/)
 * (@one3rdnerd)
 * [4 months, 1 week ago](https://wordpress.org/support/topic/conditional-field-groups-feature-request/#post-18738813)
 * Thank you, that got me 90% of the way. I did have to change to post_parent as
   it’s a page. 
   Here’s my final working code with the changed meta box div ID too.
 *     ```wp-block-code
       /** * Plugin Name: Hide Fields if not Industries */add_action(    'admin_head',    function () {        // Only run on post.php edit screen.        if (            ! isset( $_GET['post'], $_GET['action'] )            || 'edit' !== $_GET['action']        ) {            return;        }        $post_id = (int) $_GET['post'];        $post    = get_post( $post_id );        if ( ! $post || 'page' !== $post->post_type ) {            return;        }        // Get parent post.        if ( ! $post->post_parent ) {            // No parent, so parent is not "industries" -> hide meta box.            $parent_slug = null;        } else {            $parent      = get_post( $post->post_parent );            $parent_slug = $parent ? $parent->post_name : null;        }        // Hide meta box if parent slug is NOT "industries".        if ( 'industries' === $parent_slug ) {            // Parent is "industries", so do nothing, leave visible.            return;        }        ?><style>    /* Hide the Pods meta box when parent is not "industries" Change #pods-meta-case-studies to whatever your div ID is for your meta box. You can find this by inspecting the edit page screen */    #pods-meta-case-studies {        display: none;    }</style>        <?php    });
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fconditional-field-groups-feature-request%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [one3rdnerd](https://wordpress.org/support/users/one3rdnerd/)
 * Last activity: [4 months, 1 week ago](https://wordpress.org/support/topic/conditional-field-groups-feature-request/#post-18738813)
 * Status: resolved