Filter Media Library by author or post_parent

The only way to do it is using a query filter I think function wpse156319_posts_where( $where, $query ) { global $wpdb; $where .= $wpdb->prepare( ‘ AND (‘ . $wpdb->posts . ‘.post_parent = %s OR ‘ . $wpdb->posts . ‘.post_author = %s)’, $_POST[‘id’], get_current_user_id() ); return $where; } which you just add in the ajax_query_attachments_args instead … Read more

How to use the responsive images feature from WP 4.4 in your themes

Following our exchange in the comments I’ve reread your question and have a pretty straightforward answer: It looks like it’s working fine. You are worried about the sizes attribute in your second example, but it’s the srcset attribute that you should look at and it is showing all of your image sizes: <img src=”http://xxx.dev/wp-content/uploads/Delft_IMG_6275-e1453192498922.jpg” class=”attachment-full … Read more

Apply image width to tag

I am assuming you want this value on the front-end as opposed to needing it in the block editor due to the <figure> somehow not displaying correctly when viewed in the block editor. If that is the case then you can use something similar to DOMDocument as per the following example: Assume HTML of: <div> … Read more