Using unzip_file() to get contents of file
Using unzip_file() to get contents of file
Using unzip_file() to get contents of file
Filter not applied to all image sizes
Having that resulting XML file from the export it’s just a matter of editing it precisely to get rid of the images before importing it on the other site. Taking Sublime Text for example it’s pretty easy to find and select all occurrences of [caption and add a line break before them for example. Same … Read more
how to get custom attachment url?
I was able to find some helpful articles, the combination of which helped me solve this. First, I discovered that the uploadedTo information can retrieved, returning the ID. A bunch of information on attachment data can be found here. Second, I was able to convert the ID into a link for the post by simply … Read more
How to view exact image dimensions of a media in Admin view?
yes use this code here you can get attachment id if(isset($_FILES[‘myimage’]) && ($_FILES[‘myimage’][‘size’] > 0)) { // Get the type of the uploaded file. This is returned as “type/extension” $arr_file_type = wp_check_filetype(basename($_FILES[‘myimage’][‘name’])); $uploaded_file_type = $arr_file_type[‘type’]; // Set an array containing a list of acceptable formats $allowed_file_types = array(‘image/jpg’, ‘image/jpeg’, ‘image/gif’, ‘image/png’); if (in_array($uploaded_file_type, $allowed_file_types)) { … Read more
Media item permalink goes to source file instead of attachment.php
You need to alter the query using posts_where and posts_join filters. function restrict_media_images_per_post_type($query) { add_filter(‘posts_where’, ‘media_posts_where’); add_filter(‘posts_join’, ‘media_posts_join’); return $query; } add_filter(‘ajax_query_attachments_args’, ‘restrict_media_images_per_post_type’); Change “WHERE” clause to restrict to specific post type to which selected post belongs to function media_posts_where($where) { global $wpdb; $post_id = false; $whitelist_post_type = array( ‘post’, ‘{custom post type}’ //change this … Read more
Here is Media Deduper plugin. Media Deduper will find and eliminate duplicate images and attachments from your WordPress media library.