How do I get all attachments that are used in the current post, not just the children?
How do I get all attachments that are used in the current post, not just the children?
How do I get all attachments that are used in the current post, not just the children?
Hierarchy and access control for Custom Post Types (CPT)
Have you tried the following function: <?php get_post_ancestors( $post-ID ) ?> The last post in the returned array should be the highest level ancestor. This is from the Codex.
How to filter a post in the Tag Cloud widget, using tags of a media library image attached to the post?
Are you really sure you want to do this? What about all of the posts that these “old” attachments are used in? For attachments that are used for things like “featured image”, WP will take of that for you. However, for uses of an attachment in post_content, e.g. <img src=”https://wordpress.stackexchange.com/questions/258966/img_attachment_url” /> <a href=”pdf_attachment_url”>download PDF</a> you’ll … Read more
hook wp_generate_attachment_metadata does not read all the attachments
I think I’d use the get_image_tag filter for this – it provides you with the size as one of the parameters. Something along the lines of: function wrap_wide_image_tags($html, $id, $alt, $title, $align, $size) { if($size == ‘wide-image’) { $html=”<div class=”wrap-wide-image”>”.$html.'</div>’; } return $html; } add_filter(‘get_image_tag’, ‘wrap_wide_image_tags’, 10, 6); Hope this helps!
Open the Attachment Details popup
$post_attachment->post_author will return user ID. You need to fetch user details from user ID. get_userdata( $userid );
Prevent Delete Attachment by URL or When Submit