WordPress Tips, Tricks & Hacks

With the extensive functionality that WordPress provides, it’s unsurprising that even if you are a seasoned user you’ll probably have missed a few things.

Although it’s infinitely extendable, WordPress isn’t perfect. Whether it’s little annoying things, customising the look and feel of the CMS or improving productivity, there’s plenty of little quirks that we’d like solve. Fortunately with the growth of the platform comes small WordPress tricks and changes to the core code to optimise the performance and visual aspects of WordPress.

In this list we will include a few of these tips so that you can improve your website without needing to engage a website developer. These will allow you to improve your experience and get much more out of WordPress.

It’s important to note that these hacks and tips mostly involve adding code into your theme files. If you’re not confident doing this we recommend giving it a go on a backup website (you can’t learn if you don’t try!). If you are totally apprehensive about doing this we recommend involving a web designer to give you a hand.

And the last consideration is that if you are going to start editing your theme we highly recommend you create a child theme so that when you update your theme the customisations are not overwritten. You can learn how to do this easily here.

Seen a website you like, what’s the theme?

There’s a few websites out there that allow you to analyse a website to find out what theme and plugins it uses. This is perfect if you like a particular look and want to replicate it easily on your own website. Both https://whatwpthemeisthat.com and https://www.wpthemedetector.com/ allow you to do just this. Simply type in the URL of the website you’ve found and they will show you all of the plugins active as well as the name of the theme.

Customise the WordPress login area

It’s so easy to change the WordPress logo on the login page of your website that you shouldn’t need to install a plugin to get your branding included. First upload your logo to the WordPress media library and copy the link of the image. Then simply copy this code snippet into your functions.php file (again – we strongly recommend using a child theme so that your custom code isn’t overwritten when you update your theme) and change the URL to that of the image URL:

function wpb_custom_logo() {
echo '

<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {<br />
background-image: url(ADD YOUR URL HERE) !important;<br />
background-size: cover;<br />
background-position: 0 0;<br />
color:rgba(0, 0, 0, 0);<br />
}<br />
#wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {<br />
background-position: 0 0;<br />
}<br />


//hook into the administrative header output
add_action('wp_before_admin_bar_render', 'wpb_custom_logo');

Disabling post revisions

The post revisions feature in WordPress is really handy as it stores autosave versions of the pages and posts you are working on, making it easy to revert your changes if anything goes wrong. This said, if you work on a page extensively you’ll quickly build up many many revisions which can have an impact on your load speed and cause issues if you have limited database space.

Fortunately, if we do not want or need this functionality it’s quite easy to disable with a small code snippet. Simply copy this code into your wp-config.php file:

define('WP_POST_REVISIONS', false );

Stopping WordPress from mangling your code

If you’ve every tried to share code through WordPress you’ll know what a pain it is. By default WordPress converts normal quote marks into curly quote marks which, when posted into a website file, completely break the functionality (and sometimes your entire website).

You can stop this happening by copying this line of code into functions.php file:

remove_filter('the_content', 'wptexturize');

Increasing the WordPress memory limit

If you’re trying to upload a large plugin and found that you are prevented by an error then you may be able to resolve this quite easily. Increasing the memory limit of WordPress is also one of the first things to look at for a whole host of other common issues. Copy this line of code into your wp-config.php file:

define('WP_MEMORY_LIMIT', '64M');

If you need even more memory, feel free to go change “64M” to “128M” or even “512M”.

Stay logged in for even longer

WordPress keeps you logged in for 2 weeks by default if you decide to click the “Remember Me?” option when you log in. If you’re working on a development site or just get sick of logging in all the time, you can change this quite easily.

Just work out how long you’d like to be logged in for (bare in mind a longer time frame would not be a good idea if you share computers) and convert it to seconds (e.g. a month is 2629746 seconds).

Then add this into your 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

Just change the number after “return” to your desired timeframe.

Amend the footer text in the WordPress admin area

This one is great if you want to personalise your WordPress install in a small way. The following code snippet will change the footer text on every admin page:

function remove_footer_admin () {
echo “Add your own content or links here“;
add_filter('admin_footer_text', 'remove_footer_admin');


Add your own text to the WordPress comment form

If you’d like to personalise the text above the WordPress comment form this is another simple thing to accomplish. All you’ll need to do is paste this code snippet into your functions.php file:

function wpbeginner_comment_text_after($arg) {
$arg['comment_notes_after'] = “Add your own text“;
return $arg; }
add_filter('comment_form_defaults', 'wpbeginner_comment_text_after');


Removing the admin bar for non-admins

If you’re creating any kind of website that allows users to login then you probably don’t want the ugly top bar that appears in WordPress when you’re logged in.

Again, this one is a really easy one to accomplish. Go to your functions.php file and copy this code snippet:

add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {


Disabling all plugins without access to WordPress admin

Sometimes the worst happens and your website crashes. We’d bet that at least 9/10 times a plugin conflict is the cause. Sometimes this error is so bad that you are unable to access your admin area using /wp-admin.

In these cases fear not, you can disable all of your plugins simply by logging into your hosting, navigating to your file manager and finding the wp-content folder. Inside you’ll see a folder called “plugins”. Change this to something else (like “plugins-old”) and navigate back to your website. If a conflict was responsible for your downtime you should see your website is now back online. Change the folder back to “plugins” and login to your website as normal. Then jus reactive your plugins one by one to see which is the culprit.

Remove access to certain areas of the WordPress admin area for non-admins

If you want to provide other users access to your WordPress site but want to limit what they can see and do, this code snippet is for you. It will remove access to all aspects of the default WordPress pages apart from posts and pages. Copy this into your functions.php file:

function remove_menus(){
if ( !current_user_can( 'manage_options' ) ) {

remove_menu_page( 'themes.php' ); //Appearance
remove_menu_page( 'plugins.php' ); //Plugins
remove_menu_page( 'users.php' ); //Users
remove_menu_page( 'tools.php' ); //Tools
remove_menu_page( 'options-general.php' ); //Settings

add_action( 'admin_menu', 'remove_menus' );


Final thoughts

And that’s it! We hope you’ve found some of these simple code snippets useful for altering the usual WordPress functionality to make it work harder for you. As always, if you have any questions please leave a comment or get in touch.

WordPress Tips, Tricks & Hacks ultima modifica: 2019-05-21T21:22:35+00:00 da Liam Pedley


Submit a Comment

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

Latest from the blog

Biggest Mistakes of DIY Websites

Biggest Mistakes of DIY Websites

It’s never been easier to DIY your own website! There are templates that make it easy to drag and drop elements, which people can use to create a finished website design. This is the draw of free DIY websites; however, they’re often not polished, attractive or...

Are Sliders A Good Idea In Web Design?

Are Sliders A Good Idea In Web Design?

Do you have a slider on your website? If so, you’re not alone. Website sliders, also called carousels or slideshows, are everywhere on the Internet. This has been a very popular feature in web design for years; however, if you have a slider, it may be causing some...