Answer the question
In order to leave comments, you need to log in
How to determine if the image being created in Wordpress post is a thumbnail?
function add_attachment_filter($post_id) {
$att_post = get_post($post_id);
if($att_post->post_type == 'attachment' && isset($att_post->post_parent)) {
$parent_post = get_post($att_post->post_parent);
if ($parent_post->post_type == 'project') {
add_filter('intermediate_image_sizes_advanced', 'add_image_insert_override', 10, 2 );
}
}
return $post_id;
}
add_filter( 'add_attachment', 'add_attachment_filter' );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question