The forced crop of medium sized images
-
Before anyone tells me this question has been asked and answered before and points me back to a seven year old post hear me out.
I’m currently using this code:
if( false === get_option("medium_crop") ) { add_option("medium_crop", "1"); } else { update_option("medium_crop", "1"); }
Which does work to force crop any images to the exact medium sized dimensions as specified in the dashboard settings. I’m assuming all this does is change the medium_crop option in the database from a zero to a one.
However if you then decide you no longer want medium images cropped and remove this snippet from your functions.php file it will not stop-the-crop as the one in the database remains.
In order to do that you’ll need to amend the code to this:
update_option("medium_crop", "0");
I’m asking you wp guru types if there’s a more robust way of doing this? So upon delete of the snippet cropping ceases.
- The topic ‘The forced crop of medium sized images’ is closed to new replies.