Handy Code Snippets for WordPress 5.5

Heads up: This page may include affiliate links. Read the full disclosure.

WordPress 5.5 was released on the 11th of August. The new release of WordPress includes a number of new features.

MainWP has a very solid extension to be able to save and activate code snippets on all connected sites.

All of the new features in WordPress 5.5 have filters that can be used to disable those features if they are not needed.

WordPress core now supports native lazy loading since most browsers now support native lazy loading.

To be able to disable the lazy-load feature in WordPress you can use this code snippet;

add_filter( 'wp_lazy_loading_enabled', '__return_false' );

One of the larger new features is a sitemaps XML feature which will generate a XML sitemaps for all public sites. A number of SEO plugins or other plugins that already help generate an XML sitemap like Yoast SEORank Math SEO and Jetpack have as a temporary fix disabled the sitemap XML in the core. Yoast SEO and Jetpack plugins will be using the sitemaps XML feature in the core when WordPress 5.6 is released and then start building off of the core feature. The reason why you would want to disable the sitemaps XML feature if you are already using a plugin that already handles sitemaps XML creation so you do not end up with two sitemaps being created.

To be able to disable the sitemap XML feature you can use this code snippet;

add_filter( 'wp_sitemaps_enabled', '__return_false' );

WordPress 5.5 includes a new feature that has been targeted to be included in the core for a while auto-updates for plugins and themes. The new auto-updates feature for plugins and theme is a manual opt-in since by default no plugins will be updated automatically unless those plugins are selected to be updated. Since plugins and themes are already being updated by using MainWP there are two filters to be able to disable the UI for plugins and themes.

To disable the UI for the auto-updates plugins feature you can use this code snippet;

add_filter( 'plugins_auto_update_enabled', '__return_false' );

To disable the UI for the auto-updates themes feature you can use this code snippet;

add_filter( 'themes_auto_update_enabled', '__return_false' );

All of these code snippets will help in being able to disable features added in WordPress 5.5 that you may not need to use on your child sites.

Comments are closed.

Looking for something?

Privacy laws apply to businesses that collect personal information. Since no personal information is collected by the MainWP plugins, no privacy laws apply to the MainWP plugins. This includes GDPR, UK DPA 2018, PIPEDA, Australia Privacy Act 1988, LGPD, PIPL, and other privacy laws.
Donata Stroink-Skillrud
Donata Stroink-Skillrud
President of Agency Attorneys

Your Download Is Just One Click Away

…or just download the plugin.

By entering your email, you agree to our Terms of Service and Privacy Policy.