Resize existing library images

Doing this on your own is actually quite a lot of work. For the sole purpose of regenerating your custom image sizes I would recommend using this plugin: AJAX Thumbnail Rebuild It allows you to loop through your Image Library and regenerate the different image sizes that you selected.

wp_editor add media button not working

I will assume that you are creating a custom admin page at ?page=add-quiz, in this case before calling the wp_editor function you also have to enqueue the CSS / Js files for it with the wp_enqueue_media() function. So at the end you should have wp_enqueue_media(); wp_editor( ”, ‘instructions’, $settings = array(‘textarea_name’ => ‘instructions’, ‘textarea_rows’ => … Read more

Easing the download of a regularly uploaded pdf

I would use ACF (Advanced Custom Fields) to give the option to add the file to the homepage. Then once a week when he needs to update it he can just go in and replace the existing file by uploading the new one. If the description or anything has to change then you can just … Read more

Create featured image from a remote url when creating a post

The code worked for me; but I defined the function like this: function generate_featured( $post_id ), then I commented out the global $post;; and finally (although this is not mandatory..), in the $file_array, I set name like this: ‘name’ => basename( $image_url ), So: (Note that I intentionally didn’t include the whole code) function generate_featured( … Read more

Upload restrictions – upload_mimes – filter: Adding multiple MIMEs for a single extension and adding multiple extensions for a single MIME type?

This filter only accepts strings for mime types. It also already has support for webm, mp4, mpeg, ogv, and ogg. I think you can remove everything except the line for SVGs. A word of warning, WordPress doesn’t support SVG upload by default because it’s a security concern. Be careful about enabling this. At the least, … Read more

Why does get_dirsize return the same size?

Under the hood, get_dirsize() uses recurse_dirsize() which uses a transient called dirsize_cache. Try clearing that transient and check again. To do so, you can use one of the following methods: call delete_transient(‘dirsize_cache’); use WP CLI’s wp transient delete use a plugin Looking further through the source code, I think it should be possible to use … Read more