Susy - CSS Grid

7 Useful Snippets To Customise The WordPress Admin

More and more developers are using WordPress as a full featured CMS, but don’t make the effort to make it easier to use for their clients.

How to customise your WordPress Dashboard?

Custom Dashboard Message

As Remi describes in his detailed tutorial, you can remove the default WordPress Welcome dashboard message and create your own.

By creating your custom welcome dashboard message, you are giving your clients a clear and a simple way to navigate to the most important parts of the admin area.

DOWNLOAD PLUGIN

How to remove links from the WordPress admin bar?

Source – Paulund

Another way to customise the admin area is to remove unnecessary links from the admin bar.

Removing unwanted links from the bar will simplify the navigation and declutter the WordPress Admin interface.

Get the snippet

How to add links to the WordPress admin bar?

Source – WP-Snippets

Give your clients a shortcut to the most useful pages and views, or include links to some external sites or services that they might find useful.

Or include your email or phone number in case they need a hand while updating the website.

Get the snippet

How to fix 404 error when viewing custom post types?

Getting a 404 error when viewing custom post types page is annoying, and sometimes happens too often to my liking. If nothing is working, try this snippet.

Simply put flush_rewrite_rules(); after your CPT registration seems to fix it.

register_post_type('menu',$args);
flush_rewrite_rules();

How to remove the access to the main site dashboard in WordPress Multisite?

Include the below snippet if you are running a WordPress Multisite and want to restrict the access to the dashboard of the main site to everyone apart from the super admin.

add_action( 'admin_init', 'custom_wpadmin_blockusers_init' );
function custom_wpadmin_blockusers_init() {
    if ( !current_user_can( 'manage_network' ) ) {</p>
    wp_redirect( home_url() );
    exit;
}

How to remove columns in the post list created by WordPress SEO Yoast plugin?

WordPress SEO Yoast is a great plugin, but you might want to hide the generated columns on the post listing page to keep things simple and clean for you clients.

add_filter( 'wpseo_use_page_analysis', '__return_false' );

How to exclude pages from the admin pages list by ID

This is handy if you need a page to be created, but don’t want the client to be able to edit the content.

Update the array of the pages you don’t want to show in the admin list.

add_action( 'pre_get_posts' ,'exclude_this_page' );
function exclude_this_page( $query ) {
    if( !is_admin() )
        return $query;
    global $pagenow;
    if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) )
        $query->set( 'post__not_in', array(10,2,14) ); // array page ids
    return $query;
}

Conclusion

Customising the WordPress admin area should be part of your workflow on most projects, especially on projects where “blogging” isn’t the main focus.

I hope you have found some of these snippets handy and share your commonly used WordPress snippets and techniques in the comments below.

3 thoughts on “7 Useful Snippets To Customise The WordPress Admin

  1. IDESIGNSTUDIO

    The last tip on how to exclude pages by ID from the dashboard is a truly useful tip.

    We are going to use it for our latest project, where we have woocommerce installed, but using it only as a catalog, so tons of woocommerce pages that the plugin creates by itself are at the moment unnecessary but still in the dashboard. It gets too much for the client and we constantly have questions regarding pages which are there, but not used anywhere on the website.

    Very useful tip! Thanks.

    Reply
  2. IDESIGNSTUDIO

    The thing is we never saw this tip in any other WP admin customization articles till now. We are reading your blog since couple of days but what we already have noticed is that there are these big and small treasures all over ALL your posts.

    It makes your blog very extraordinary and truly written from crafted experience.

    You are speeding the process of work and company development. Truth.

    Reply

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.