Images uploading to wrong directory after changing to multisite

Check the value of the ms_files_rewriting option in the site_options table. If ms_files_rewriting is disabled, then WordPress will automatically append /sites/number to that Upload Path value for the subsites. This setting should be disabled by default for any Multisite networks created after WordPress 3.5. It should only be enabled for older networks. If that setting … Read more

Image sizes and order of operations

wp_get_attachment_image_src will always return a URL to a file if the image exists in some size. If the size you ask for doesn’t exist then you get the URL for the full size image as uploaded. (This isn’t the “large” image size.) So, for a valid image ID, your conditional if(wp_get_attachment_image_src($id, array($preferred_size, $preferred_size))) will always … Read more

How to set dimensions of the post thumbnails (featured images)

Add this code to your theme’s functions.php file. Images are resized by WordPress when they are uploaded. A plugin such as Regenerate Thumbnails can be used to ensure that source images have been properly generated if image sizes are changed after the initial upload. // Sets the parameters for the post-thumbnail image size // https://codex.wordpress.org/Function_Reference/set_post_thumbnail_size … Read more