Better wordpress attachment query than this
I don’t have the data to test so the code below may be wrong. add_filter(‘posts_search’, ‘set_is_tax_to_true’ ,10,2); function set_is_tax_to_true($search,$query){ $query->is_tax = true; } $args = array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘post_status’ => ‘pending’, ‘post_parent’ => $post_id, ‘order’ => ‘ASC’, ‘orderby’ => ‘ID’, ‘meta_query’=> array( array( ‘key’ => ‘cp_sys_expire_date’, ‘value’ => current_time(‘mysql’), ‘compare’ => … Read more