Estimated reading time: 2 min
Best Function Trick for WordPress to Have (SEO Tip + Useful Code)
Improve your WordPress site’s performance and SEO with this simple yet powerful function trick. By removing unnecessary scripts, you can drastically cut load times and enhance user experience.

Boost Speed with This WordPress Function Hack
When it comes to optimizing your WordPress website, performance is key. A fast-loading site not only keeps visitors happy but also ranks better in search engines. While plugins can help, there’s a lightweight method that involves using your theme’s functions.php
file to remove scripts and styles you don’t need.
Why Disable Unused Scripts?
WordPress loads several scripts by default like emoji support, jQuery Migrate, and Gutenberg block CSS even if your site doesn’t use them. These extras slow down your page, increase HTTP requests, and hurt performance scores on tools like Google PageSpeed Insights and GTmetrix.
By disabling them, your site becomes leaner and faster, which translates to a better experience for users and better rankings on search engines.
The Code to Add for Function Trick
Copy and paste the following code into your active theme’s functions.php
file:
function remove_wp_junk() {
// Remove emoji scripts
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
// Remove jQuery Migrate
function dequeue_jquery_migrate($scripts) {
if (!is_admin() && isset($scripts->registered['jquery'])) {
$script = $scripts->registered['jquery'];
if ($script->deps) {
$script->deps = array_diff($script->deps, ['jquery-migrate']);
}
}
}
add_filter('wp_default_scripts', 'dequeue_jquery_migrate');
// Remove Gutenberg block styles
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wp-block-library-theme');
}
add_action('wp_enqueue_scripts', 'remove_wp_junk', 100);
Final Tips
Always back up your site before editing theme files, or work on a child theme to avoid losing changes during updates. After implementing the code, clear your cache and test your site’s performance—you’ll likely see an immediate improvement.
🏷️ Tags: wordpress optimization, speed up wordpress, wordpress tricks, functions.php, wordpress seo, remove emoji, remove jquery migrate, boost site speed, wordpress performance, web development tips
Discover more from HelpZone
Subscribe to get the latest posts sent to your email.