How to set a Minimum Image Dimension for Uploading

The $file array doesn’t have anything that you’d be able to use, but $GLOBALS has some helpful information. You can uncomment the debugging line that contains $GLOBALS to see what it contains. I have added a guard clause to the top of the tc_handle_upload_prefilter function. This ensures that the file size checking code is only … Read more

Image with description side by side

Yes, I think this is a great, fundamental question of WordPress editing and content creation by low-level users who are met with the big blank editing area and don’t know how to wrangle html. There are myriad answers: hardcore coding, softcore coding, plugins and everything in-between. The answer for me is Advanced Custom Fields. I … Read more

Editing built in Gallery shortcode to filter by categories

There are various ways to run another WP_Query with a tax query and collect the ID’s into the include attribute of the gallery shortcode. Let’s try another approach, without running a secondary WP_Query. Native gallery: Support taxonomy and term attributes We introduce the following custom gallery shortcode attributes: Here’s a demo plugin that supports that … Read more

How to prevent resized featured images?

Featured image sizes are mostly likely controlled by your theme, so I would look there. Maybe there is a theme setting for it. You can also check the following setting to see if it us using one of those sizes. You can change the featured image size by adding this code into your functions.php file. … Read more

Can’t access ‘Store uploads in this folder’

This is a very good question. The answer to the referenced post requires a change to the WP options. They are stored in the database in the wp_options table (assuming wp_ is your prefix). There are a few ways to change these in this case: Direct DB access: if you’re comfortable modifying the WP DB … Read more

How to make programmatic image upload generate thumbnail and sizes?

In order for wp_generate_attachment_metadata() to work properly in that it creates a thumbnail and other intermediate/image sizes like medium and large, the image attachment/post data must have the proper MIME type (post_mime_type), and despite you did set it in your $attachment array (the post data), there’s a problem with this part in your code: $wp_filetype … Read more