7 WordPress tricks and hacks to use on every site

Although WordPress is really powerful CMS there are some annoying things I would like to be deactivated by default. For example, I don’t see the reason why commenting should be enabled by default. Therefore, today I’m going to show you 7 best WordPressi tricks I‘m using on every site.

Before we start you need to know that you need to add all the code snippets here below either to your child theme’s functions.php file or better yet, inside Code Snippets plugin code box.

Disable WordPress comments without a plugin

Instead of using a Disable Comments plugin (or similar) you can get rid of the comment area by using this snippet here.

// Disable comments
function __disable_feature($data) { return false; }
add_filter('comments_number', '__disable_feature');
add_filter('comments_open', '__disable_feature');

Remove Emojis

Why would one want to do so? Well, take me for example. I haven’t use any emojis on my sites for years and I’m not planning to use them either. But, since they are activated by default, then every time you load a page an emoji script is loaded. Therefore, I’m removing emoji script to reduce the page load size and requests.

// Remove Emojis
add_action( 'init', 'generate_disable_wp_emojicons' );
function generate_disable_wp_emojicons() 
	// all actions related to emojis
	remove_action( 'admin_print_styles', 'print_emoji_styles' );
	remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
	remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
	remove_action( 'wp_print_styles', 'print_emoji_styles' );
	remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
	remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
	remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );

Unregister unnecessary WordPress widgets

WordPress Widgets area is loaded with all sorts of widgets 95% users won’t need. Take Archive or Calendar widgets for example. So, with this little code snippet here below you can remove these widgets you don’t need and unclutter your widgets area.

// Unregister widgets
function unregister_default_widgets() {
unregister_widget( 'WP_Widget_Tag_Cloud' );
add_action('widgets_init', 'unregister_default_widgets', 11);

Remove WordPress dashboard widgets

Now let’s modify a WordPress dashboard which is also full of unnecessary widgets. Yes, you can turn then off under Screen options by I like to deactivate them for all users. So, grab this code and remove WordPress dashboard widgets you don’t need.

function remove_widgets() {

	remove_meta_box( 'dashboard_primary','dashboard','side' ); // WordPress.com Blog
	remove_meta_box( 'dashboard_plugins','dashboard','normal' ); // Plugins
	remove_meta_box( 'dashboard_right_now','dashboard', 'normal' ); // Right Now
	remove_action( 'welcome_panel','wp_welcome_panel' ); // Welcome Panel
	remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel'); // Try Gutenberg
	remove_meta_box('dashboard_quick_press','dashboard','side'); // Quick Press widget
	remove_meta_box('dashboard_recent_drafts','dashboard','side'); // Recent Drafts
	remove_meta_box('dashboard_secondary','dashboard','side'); // Other WordPress News
	remove_meta_box('dashboard_incoming_links','dashboard','normal'); //Incoming Links
	remove_meta_box('rg_forms_dashboard','dashboard','normal'); // Gravity Forms
	remove_meta_box('dashboard_recent_comments','dashboard','normal'); // Recent Comments
	remove_meta_box('icl_dashboard_widget','dashboard','normal'); // Multi Language Plugin
	remove_meta_box('dashboard_activity','dashboard', 'normal'); // Activity
	remove_meta_box('dashboard_site_health', 'dashboard', 'normal'); // Site health
	remove_meta_box( 'e-dashboard-overview', 'dashboard', 'normal'); // Elementor
add_action( 'wp_dashboard_setup', 'remove_widgets' );

Add file size column to your WordPress Media list table

As the heading says, this snippet here below adds a file size column so you can see how big are the uploaded files without the need to open every file one at a time.

add_filter( 'manage_media_columns', 'sk_media_columns_filesize' );
 * Filter the Media list table columns to add a File Size column.
 * @param array $posts_columns Existing array of columns displayed in the Media list table.
 * @return array Amended array of columns to be displayed in the Media list table.
function sk_media_columns_filesize( $posts_columns ) {
	$posts_columns['filesize'] = __( 'File size', 'my-theme-text-domain' );

	return $posts_columns;

add_action( 'manage_media_custom_column', 'sk_media_custom_column_filesize', 10, 2 );
 * Display File Size custom column in the Media list table.
 * @param string $column_name Name of the custom column.
 * @param int    $post_id Current Attachment ID.
function sk_media_custom_column_filesize( $column_name, $post_id ) {
	if ( 'filesize' !== $column_name ) {

	$bytes = filesize( get_attached_file( $post_id ) );

	echo size_format( $bytes, 2 );

add_action( 'admin_print_styles-upload.php', 'sk_filesize_column_filesize' );
 * Adjust File Size column on Media Library page in WP admin
function sk_filesize_column_filesize() {
		.fixed .column-filesize {
			width: 10%;

Add menu for WordPress Reusable Blocks

If you’re using Reusable Blocks then you need a shortcut to them. Here is the code snippet which adds a Reusable Blocks menu to the WordPress admin sidebar.

function reusable_blocks_menu() {
    add_menu_page( 'Reusable Blocks', 'Reusable Blocks', 'edit_posts', 'edit.php?post_type=wp_block', '', 'dashicons-editor-table', 10 );
add_action( 'admin_menu', 'reusable_blocks_menu' );

Disable WordPress auto-update email notifications for plugins and themes

Since WordPress 5.5 there is a nifty feature which allows you to activate auto-updates for themes and plugins. If you do so then you will be surprised about how many “Your plugin is updated” email you receive weekly. Therefore, If this annoys you lik it annoys me, then use this snippet here below to deactivate those emails.

// Disable auto-update email notifications for plugins.
add_filter( 'auto_plugin_update_send_email', '__return_false' );
// Disable auto-update email notifications for themes.
add_filter( 'auto_theme_update_send_email', '__return_false' );

Bonus tip: Leverage Browser caching and enable GZIp compression

Header unset Pragma
FileETag None
Header unset ETag
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType text/css "access 1 week"
ExpiresByType text/html "access 0 seconds"
ExpiresByType text/xml "access 0 seconds
ExpiresByType text/json "access 0 seconds
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"

<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

Video: 7 WordPress tricks and hacks to use on every site

Useful tips

Here are some of my favorite WordPress tools

Thanks for reading this article! I hope it's been useful as you work on your own websites and e-commerce sites. I wanted to share some tools I use as a WordPress developer, and I think you'll find them helpful too.

Just so you know, these are affiliate links. If you decide to use any of them, I'll earn a commission. This helps me create tutorials and YouTube videos. But honestly, I genuinely use and recommend these tools to my friends and family as well. Your support keeps me creating content that benefits everyone.

Themes: Over the past few years, I've consistently relied on two primary themes for all sorts of projects: the Blocksy theme and the Kadence Theme. If you explore this website and my YouTube channel, you'll come across numerous tutorials that delve into these themes. If you're interested in obtaining a 10% discount for both of these themes, then:

Code Snippets Manager: WPCodeBox allows you to add code snippets to your site. Not only that, but it also provides you with the capability to construct and oversee your WordPress Code Snippets library right in the cloud. You can grab it with the 20% discount here (SAVE 20% Coupon: WPSH20).

Contact forms: There are hundreds of contact forms out there but Fluent Forms is the one I like the most. If you need a 20% discount then use this link (save 20% coupon is WPSH20).

Gutenberg add-ons: If I need a good Gutenberg blocks add-on then Kadence Blocks is the one I have used the most. You’ll get a 10% discount with the coupon SIMPLEHACKS here.

Website migration: While building a website you probably need a good plugin that can help you with the migration, backups, restoration, and staging sites. Well, WpVivid is the one I have used for the last couple of years. If you use this link along with the WPSH20 coupon you’ll get a 20% discount.

Woocommerce extensions: There are a bunch of Woocommerce extensions that I really like but the one that stands really out is Advanced Dynamic Pricing. Once again, you’ll get a 20% discount if you use this link here (save 20% coupon is WPSH20)

Web Hosting: If you would like to have a really fast and easy-to-use managed cloud hosting, then I recommend Verpex Hosting (see my review here). Btw, this site is hosted in Verpex.)

To see all my most up-to-date recommendations, check out this resource that I made for you!

Do you want to thank me and buy me a beer?

Every donation is entirely welcome but NEVER required. Enjoy my work for free but if you would like to thank me and buy me a beer or two then you can use this form here below.

Donation Form (#2)

Best selling plugins

Janek T.
Janek T.

I am a Wordpress enthusiast who has been making websites since 2011. In this site I am offering simple to follow tips on how to use Wordpress and Woocommerce.
If you want to be the first to be notified about the new tutorials then please subscribe to my Youtube channel here
Follow me in Twitter here

Articles: 101