Uncaught Error: Call to undefined function file_is_valid_image()

I’m running the code above as WP cron The file_is_valid_image function is defined in wp-admin/includes/image.php, and this file is loaded automatically only on WordPress admin pages (in wp-admin). So if you want to use that function on other/non-admin pages, e.g. a page in the site’s front-end, a REST API endpoint, or wp-cron.php which runs during … Read more

problems with alt text not appearing in source code

The display/use of various <img> attributes is up to the theme code. If the theme code does not use the info from the media item, then it will not display. Fixing this will require digging into the theme code to figure out where the <img> code is generated, and then modifying that code. Note that … Read more

Using “add_image_size” to register custom image sizes inside plugins not working

There’s several misunderstandings about how WordPress works here. I noticed that most examples of add_image_size() is done via the after_setup_theme hook. Which means, for it to register, one has to switch theme and reactivate the theme. Firstly, that’s not what it means. The after_setup_theme hook runs on every page load after the theme has been … Read more