How to check if user is uploading/setting an image as a featured image?

Determining if an attachment actually is a featured image is easy: get_post_thumbnail_id( get_post() ); which is a convenience function around get_post_meta( get_post()->ID, ‘_thumbnail_id’, true ); It is a bit more complicated if you know nothing than the File name or Url. add_filter( ‘wp_handle_upload_prefilter’, function( $file ) { $url = wp_get_attachment_image_src( get_post_thumbnail_id( get_post() ), ‘post-thumbnail’ ); … Read more

Converting Attachment to Images?

Although it shouldn’t change based on your theme, this may be an issue caused by how this new theme handles images. As of WordPress 3.5, when you add a media object such as an image, there’s a sidebar that appears on the right. Underneath the “Attachment Details” (preview, title, caption, etc.) there’s a section called … Read more

Multiple instances of Featured Image Query

For both loops move <a href=”https://wordpress.stackexchange.com/questions/67673/<?php the_permalink(); ?>”> To after while ( $the_query->have_posts() ) : $the_query->the_post(); the_permalink() is template tag and as such generates what it does, based on global $post variable. In your custom loop it doesn’t contain the post you want until after $the_query->the_post() call.

Hide upload image fields for the different media upload popups

I’m familiar with attachment_fields_to_edit and don’t recall ever seeing anything on being able to do modification as granular as you’re suggesting. There’s a WP global $screen (or is it $screens) that perhaps might help but I’m not too sure. Have you considered – as hacky as it might sound – doing these things with CSS … Read more