skip to Main Content

Only Show Staff Settings in the Theme Settings Metabox

By default the Total theme displays a "Theme Settings" metabox on all core public post types which includes various settings to modify the post on independently. This meta box can be disabled completely via the Theme Panel but it can also be modified via custom code. This snippet shows how you can modify the Theme Settings so when editing a staff post it will only display the staff settings and not all the other general settings.

/**
 * Modify the Theme Settings metabox to display only the Staff settings when editing a staff post.
 *
 * @link https://total.wpexplorer.com/docs/snippets/only-show-staff-settings-in-the-theme-settings-metabox-when-editing-staff-posts/
 */
add_filter( 'wpex_metabox_array', function( $settings, $post ) {
    if ( 'staff' === get_post_type( $post ) && isset( $settings['staff'] ) {
        $settings = [
            $settings['staff'],
        ];
    }
    return $settings;
}, 10, 2 );
All PHP snippets should be added via child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)
Back To Top