How to Remove Metaboxes on Genesis Framework Settings Page

Whenever I develop a site for a client, I usually remove unnecessary items (widgets, links, settings) from the site to make it easier for the client. Besides removing unnecessary default dashboard widgets for a more clean dashboard, I usually remove any unnecessary settings from Genesis Framework settings page.

Note: As a developer, I use Genesis Framework to help me build a custom theme. It saves a lot of my time..

Here’s a look of Genesis settings page:

genesis framework settings page

As you can see, there are lots of stuffs in there.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<?php
/**
* Remove metaboxes in Genesis settings page
*
* @since 1.0.0
* @param string $_genesis_theme_settings_pagehook
*/
function afn_remove_metaboxes( $_genesis_theme_settings_pagehook ) {
remove_meta_box( 'genesis-theme-settings-feeds', $_genesis_theme_settings_pagehook, 'main' );
remove_meta_box( 'genesis-theme-settings-header', $_genesis_theme_settings_pagehook, 'main' );
remove_meta_box( 'genesis-theme-settings-nav', $_genesis_theme_settings_pagehook, 'main' );
remove_meta_box( 'genesis-theme-settings-breadcrumb', $_genesis_theme_settings_pagehook, 'main' );
remove_meta_box( 'genesis-theme-settings-comments', $_genesis_theme_settings_pagehook, 'main' );
remove_meta_box( 'genesis-theme-settings-posts', $_genesis_theme_settings_pagehook, 'main' );
remove_meta_box( 'genesis-theme-settings-blogpage', $_genesis_theme_settings_pagehook, 'main' );
remove_meta_box( 'genesis-theme-settings-scripts', $_genesis_theme_settings_pagehook, 'main' );
}
add_action( 'genesis_theme_settings_metaboxes', 'afn_remove_metaboxes' );
view raw functions.php hosted with ❤ by GitHub

To remove any of the metaboxes from Genesis settings page, simply use the code above in functions.php file of your child theme.

It’s that simple. If you’ve any question, feel free to drop your comment in the comment section below.

Comments

  1. says

    Editor, how do you combine this with “if” parameter used in this post about removing metaboxes from post editor?

    I’ve added this before line 10 in your code:

    if( !current_user_can(‘manage_options’) ) {

    I closed the curly brackets on line 18 (added a second one) but WP gave me an error. How would you add the conditional so that a user could not see all those options on Genesis theme settings, but the admin could?

Leave a Reply

Your email address will not be published. Required fields are marked *