Remove Unused Menu Locations

Seems like you’re using a parent theme or a plugin that registers those menu locations. If that’s the case then you shouldn’t remove your last function. You need to keep the remove_default_menu function in your functions file. If you are not using a parent theme or some sort of plugin than that means you are … Read more

Remove default Image Sizes

To unset all default image sizes in WordPress using PHP you can use this function: add_filter( ‘intermediate_image_sizes’, ‘remove_default_img_sizes’, 10, 1); function remove_default_img_sizes( $sizes ) { $targets = [‘thumbnail’, ‘medium’, ‘medium_large’, ‘large’, ‘1536×1536’, ‘2048×2048’]; foreach($sizes as $size_index=>$size) { if(in_array($size, $targets)) { unset($sizes[$size_index]); } } return $sizes; } Alternatively, you can also unset default images by going … Read more

Why can’t I enter the wordpress admin interface?

The error message you see points to this part within the wp-login.php file: setcookie( TEST_COOKIE, ‘WP Cookie check’, 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); to its “path”, which is the 4th parameter: SITECOOKIEPATH If you check how that constant is defined, that is: define( ‘SITECOOKIEPATH’, preg_replace( ‘|https?://[^/]+|i’, ”, get_option( ‘siteurl’ ) . “https://wordpress.stackexchange.com/” ) ); meaning … Read more

wp_enqueue_scripts with JS script as a string

Unfortunately, wp_enqueue_script doesn’t work that way — the second parameter is for a URL as per the documentation. But you could use wp_add_inline_script() (if there’s an enqueue’d script to attach it to) or, as in olden times, just hook in to wp_head or wp_footer.

How to automatically convert images to WebP on WordPress?

Doing this in vanilla WordPress using hooks requires code that hasn’t been released yet, specifically: https://core.trac.wordpress.org/changeset/53751 https://core.trac.wordpress.org/ticket/55443 That Trac ticket adds new filters which are available in WordPress 6.1. Note that if your server cannot process webp images for resizing then webp will not work for you even with these filters. You will need to … Read more