How to save WordPress post and attachment images from front end using media library?
How to save WordPress post and attachment images from front end using media library?
How to save WordPress post and attachment images from front end using media library?
After a thorough inspection of the database, i saw that the post_type for the images had changed to “post” instead of “attachment“. The solution Update Post mime type from “post_status = inherit” sql: // Mime type – img/jpeg UPDATE wp_posts SET post_type = ‘attachment’ WHERE wp_posts.post_status = ‘inherit’ and wp_posts.post_mime_type = ‘image/jpeg’; // Mime type – img/png UPDATE wp_posts SET post_type = ‘attachment’ WHERE wp_posts.post_status = ‘inherit’ and wp_posts.post_mime_type = ‘image/png’; // Mime type – img/webp UPDATE wp_posts SET post_type = ‘attachment’ WHERE wp_posts.post_status = ‘inherit’ and wp_posts.post_mime_type = ‘image/webp’; // Mime type – … Read more
You can use the before_delete_post action hook for this purpose as it triggers just before WordPress deletes a post (or media) which allows you to utilize its ID in time. function my_plugin_image_deleted( $post_id ) { // Ensure type is attachment (could be a page, post, etc. otherwise) if ( ‘attachment’ === get_post_type( $post_id ) ) … Read more
The issue with your code is that the testCatalog function is being called on every page load due to its hook into the init action. Since init runs on every WordPress request (both front-end and admin), your function is uploading the image each time a page is loaded. This is why you see the same … Read more
So, I figured out why this only worked once, and not every time afterward. I have the ID and URL wrapped in a <span> with an ID and class tied to it. However when the if(response.success === true) { fired, and updated the ID and URL of the image, it overwrote the entire <span> with … Read more
There are a lot of Paid Plugins for that and also you can use online Free Resource for that, but not all of them allow the Batch Process. Although I have use JPG To Webp for image compression. You can try if it helps you, although If you have good budget then try some PRO … Read more
As you can see in wp-includes/script-loader.php, the exact message ‘An error occurred in the upload. Please try again later.’ is the default error message. After looking further in wp-includes/js/plupload/handlers.js you can realize that something specific happened. You could debug this by setting a breakpoint to look up exact error code. See https://stackoverflow.com/a/13372025/2234089 for more information … Read more
I can’t see all images in my media library – How Can I reset the index of that library?
It’s probable that HTML tags are being removed from output. You can test this by adding other HTML tags (ex: <strong>) and see if they are removed. If the bold text shows, it’s possible then that bold text is permitted but not links (using wp_kses() or similar). I backtracked the code quite a bit to … Read more
No, there isn’t. Unless there’s an apply_filters() call, you can’t modify any of the output. You mentioned “the only hook is to the entire function”, but that’s not the case either. There is a do_action() call at the end, but this is an action hook, so it only lets you run something at the end … Read more