Select Page

Output additional image sizes on the frontend of WordPress

Use this to find all the additional image sizes your site is using /* Output all image sizes on the frontend ---------------------------------------------------------------------------------------------------- */ add_action('init', 'get_all_image_sizes'); function...

Disable Divi Custom Post Type CSS file

Add this to your functions files to disable/remove the Divi CPT CSS file from being used. /* Disable Divi CPT CSS */ function disable_cptdivi() { remove_action( 'wp_enqueue_scripts', 'et_divi_replace_stylesheet', 99999998 ); } add_action('init', 'disable_cptdivi');...

How to enable WordPress debug mode and log errors

To enable error logging, create an empty file named “php-errors.log”. Place it in a directory that is not publicly accessible (preferably outside your web root) and ensure it is writable by the web server. Then add the following code to wp-config.php:...

Remove query strings from static resources in WordPress

Use this to remove query strings from static resources in WordPress // Remove query strings from static resources function _remove_script_version( $src ){ $parts = explode( '?ver', $src ); return $parts[0]; } add_filter( 'script_loader_src', '_remove_script_version',...

Leverage Browser Caching in WordPress via .htaccess

Add this to your .htacess to Leverage Browser Caching ## https://crunchify.com/how-to-speed-up-wordpress-leveraging-browser-caching-via-htaccess/ ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access 1 year"...

How to delete all images from your WordPress site

Use this SQL to remove all images/documents/etc from your media library 1 – Run these in phpmyadmin DELETE FROM wp_postmeta WHERE post_id IN ( SELECT id FROM wp_posts WHERE post_type = 'attachment' ) ; DELETE FROM wp_posts WHERE post_type = 'attachment' 2...