I keep this page updated with the code snippets and commands that I need most often for WordPress.
- Set memory limit for WordPress:
Add these lines anywhere in your ‘wp-config.php’ file located in the root directory of your site.
/* Set our WordPress memory limit to 512 megabytes */
define('WP_MEMORY_LIMIT', '512');
- Set proper WordPress file permissions recursively. running from the web root of the site:
find . -type f -exec chmod 644 {} +
find . -type d -exec chmod 755 {} +
- Create a new password hash to copy and paste directly into a user’s password field, found in the wp_users table in your database:
Go to Useotools WordPress Password Hash Generator
- Disable lazy-loading of images in WordPress core, place in functions.php :
add_filter( 'wp_lazy_loading_enabled', '__return_false' );
– Disable all ‘canonical’ tags globally, place in functions.php :
// Disable Canonical for - ALL pages
function remove_canonical() {
add_filter( 'wpseo_canonical', '__return_false', 10, 1 );
}
add_action('wp', 'remove_canonical');
