7 Exciting Hacks to Customize Your WordPress Dashboard
If you're running your website or blog on WordPress, the most popular content management system and blogging platform on the web, then you're about to learn different hacks you can apply to customize your WordPress dashboard and greatly enhance your experience on the platform.
In the end, you should be able to make your WordPress dashboard way more convenient and intuitive for your use.
The WordPress dashboard is the heart of your site. We love to describe it as the "operating room" of a [WordPress-powered] website. It is where you operate your site from, enforcing controls and effecting changes as you like.
With millions of users around the world, WordPress is built to cater to the needs of these multiple people generally. It doesn't come customized for each user, making the contents of the dashboard generic and requiring some sort of customization to fit in with your preferences.
One solution is to optimize the WordPress dashboard with plugins, and there are tons and tons of plugins for almost every need. But the downside is that plugins come with their own problems. For instance, the more plugins you install on your site, the heavier the site would be thereby making it slow to load. Slow websites have a way of dealing with heavy blows on user experience and search engine rankings (hint: users and Google hate slow websites).
On the flip side, you can enable many interesting features on your WordPress site without using plugins. This means you don't have to put in hundreds of hours tweaking or updating plugins.
This resource discusses seven operable WordPress hacks you can implement to customize your WordPress.org dashboard and activate some useful features without plugins. This should help you better your WordPress experience and get the most out of the tool. Mind you, this involves playing around with code, but it is totally safe and easy.
1. Rebrand the WordPress dashboard with your own logo
On the WordPress dashboard, there are basically two areas where the “W” WordPress logo is used by default.
-
The login screen; and
-
The admin header area
Did you know you can replace these logos with your customized brand logo?
Of course, you can! And it's easy.
To change the logo on the login screen, simply open your functions.php file and paste this code:
function my_custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_bloginfo('template_directory').'/images/custom-login-logo.gif) !important; }
</style>';
}
add_action('login_head', 'my_custom_login_logo');
And to replace the logo in the administrative header with a custom alternative, just paste this in the theme’s functions.php file again:
function custom_admin_logo() {
echo '<style type="text/css">
#header-logo { background-image: url('.get_bloginfo('template_directory').'/images/admin_logo.png) !important; }
</style>';
}
add_action('admin_head', 'custom_admin_logo');
You now should tweak your logo to fit the allocated space, call it admin_logo.png, and put the same in the wp-images folder.
2. Stay logged in for a longer period
It's recommended that you log out of your WordPress dashboard after you're done working on public wi-fi networks, or if you were using a computer that's not yours.
But when you're on your home network and using your computer, getting kicked out after a while might not provide you with the best WordPress user experience.
The default WordPress behavior is to log a user out by making a login session cookie that expires in 48 hours, or when the browser is closed. Login time is extended to 14 days if the “Remember Me” box on the login page is checked, only after which WordPress would force you to authenticate again.
You can resolve this. To extend your WordPress login session, copy and paste this code in the functions.php file:
add_filter( 'auth_cookie_expiration', 'stay_logged_in_for_1_year' );
function stay_logged_in_for_1_year( $expire ) {
return 31556926; // 1 year in seconds
}
Simply replace the "31556926" with your preferred time span to set the expiry date of the authorization login cookie.
3. Change the auto-save interval
When you're working on a WordPress post or page, WordPress automatically saves your work so you don't get screwed in the event of a browser crash or a blackout.
This happens within one-minute intervals. For some users, the default one minute may not be sufficient as they keep interrupting their work to push the save button. So how about decreasing the time span between auto-saves without a plugin? Sounds great?
Well, it's pretty easy. Add the following code to the wp-config.php file on your WordPress dashboard:
define( 'AUTOSAVE_INTERVAL', 45 );
You can change the “45” seconds to a time span that best meets your needs.
4. Remove/add dashboard widgets
The default WordPress dashboard comes pre-loaded with widgets like the WordPress news feed. The fact is some of the widgets are purely adjunctive and even useless.
To streamline your dashboard and enhance your WordPress experience, it's okay to get rid of some of the widgets and even add some custom ones.
To remove widgets, place this code in the functions.php file:
function disable_default_dashboard_widgets() {
remove_meta_box('dashboard_right_now', 'dashboard', 'core');
remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');
remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');
remove_meta_box('dashboard_plugins', 'dashboard', 'core');
remove_meta_box('dashboard_quick_press', 'dashboard', 'core');
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');
remove_meta_box('dashboard_primary', 'dashboard', 'core');
remove_meta_box('dashboard_secondary', 'dashboard', 'core');
}
add_action('admin_menu', 'disable_default_dashboard_widgets');
Each line of the code inside the function removes a different widget as the name states, which means you can add or remove these lines at will for each of the different default widgets.
On the other hand, you can also add your own custom widgets to display things like custom stats, support information, and so on.
It's pretty simple to do so: just place whatever you want to appear within the second function in the code below. Ensure you customize the third parameter of the function on line three to your own widget name.
function my_custom_dashboard_widgets() {
global $wp_meta_boxes;
wp_add_dashboard_widget('custom_help_widget', 'My Widget Title', 'custom_dashboard_help');
}
function custom_dashboard_help() {
echo 'My widget content';
}
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');
5. Delay posting to your RSS feeds or completely disable it
Imagine that you [mistakenly] published a post on your blog just when you weren't quite ready to publish it. Maybe it had a typo in the headline or the body wasn't yet properly formatted.
But then, you found that the RSS feed already sent it out to your RSS subscribers… with the mistakes in it. You could have easily corrected the error if only you had some more time to check things out adequately, right?
Well then, why not delay your RSS from picking up your posts, maybe by an hour or so?
To do this, open the functions.php file and add this code:
function Delay_RSS_After_Publish($where) {
global $wpdb;
if (is_feed()) {
$now = gmdate('Y-m-d H:i:s');
$wait = '60';
$device = 'MINUTE';
$where.=" AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
}
return $where;
}
add_filter('posts_where', 'Delay_RSS_After_Publish');
Do remember to edit the $wait = '60'; line (which is sixty minutes) and insert a number that makes you feel like a star.
Or you can completely disable your RSS feed.
The RSS functionality is great for blogs, but if you think otherwise or are simply using your WordPress install as a static site, disabling the feature is not bad.
So to totally disable RSS feeds, you'd need to paste the code below into the functions.php file:
function cwc_disable_feed() {
wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
}
add_action('do_feed', 'cwc_disable_feed', 1);
add_action('do_feed_rdf', 'cwc_disable_feed', 1);
add_action('do_feed_rss', 'cwc_disable_feed', 1);
add_action('do_feed_rss2', 'cwc_disable_feed', 1);
add_action('do_feed_atom', 'cwc_disable_feed', 1);
The code can as well disable other feeds as RSS2 and Atomic feeds, but it's at your disposal to decide what to allow by adding or removing the applicable line of code.
6. Display Google Analytics data on your WordPress dashboard
The data is great. It helps you measure your progress and results, make informed decisions, and manage your website better.
How about you bring your website data right into your WordPress dashboard? Think metrics like the number of users, locations, sessions, duration of sessions, bounce rates, device types used, etc.
You can easily enable this with Google Analytics in either of the two ways:
-
Inserting Google Analytics code into your theme files.
-
Installing a Google Analytics plugin.
This should help you answer questions like:
-
Is my website growing? And what channels drive the most visitors?
-
Is my website converting? How many times do visitors complete the goal?
-
What are people doing on my website? How many pages do they view and for how long?
7. Replace
the default WordPress editor font
Think the default font used in the WordPress editor isn't awesome enough?
That's not a problem! Simply paste the following code snippet into your theme’s functions.php file. And then specify which fonts to use on line # 5.
add_action( 'admin_head-post.php', 'cwc_fix_html_editor_font' );
add_action( 'admin_head-post-new.php', 'cwc_fix_html_editor_font' );
function cwc_fix_html_editor_font() { ?>
<style type="text/css">#editorcontainer #content, #wp_mce_fullscreen { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; }</style>
<?php }
LET'S WRAP IT UP HERE!
Customizing your WordPress dashboard not only allows for a rebranding of the backend of your website, but it also significantly enhances your WordPress user experience. And it can be done so easily!
Of course, some of the customizations we've featured in this guide can also be achieved with the use of plugins, but plugins can quickly pile up and make your website slow and clunky. The fewer plugins you use, the faster and more dynamic your website; and by extension, the better user experience your site will offer visitors.
Don't get this wrong: plugins aren't bad. We are saying you should only install those that are crucial to your website. And manually activate other features using the hacks we've shared in this guide.
But be cautious though. Depending on what theme you use, the code snippets provided above may require special attention. So we recommend that you first create a backup before kicking this off.