pigen_attachment_pre_get_posts
-
In function pigen_attachment_pre_get_posts there should be something similar, not new call get_posts, I have some trouble with plugin “WP Real Media Library”
$mq = $query->get(‘meta_query’);
if (!is_array($mq)) {
$mq = array();
}if ($folder > 0) {
$mq[] = array(
‘key’ => ‘_thumbnail_id’,
‘value’ => ”,
‘compare’ => ‘=’
);$query->set(‘meta_query’, $mq);
}If you want exclude thumbs, you can use better filter for this..
add_filter( ‘posts_where’ , ‘remove_images’ );
function remove_images($where) {
global $wpdb;
$where.=’ AND ‘.$wpdb->posts.’.post_mime_type NOT LIKE \’pdf/%\”;
return $where;
}
- The topic ‘pigen_attachment_pre_get_posts’ is closed to new replies.