This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Ignore unlinked Attachments

#21515
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Yes, that is the latest one. I checked the source on the attachment search class, and the attachment results shoul have the $r->content_type as ‘attachment’. If it’s ‘pagepost’, then it’s a different post type in that case.

Try testing it by printing the post type to the title:

add_filter('asp_results', 'asp_results_remove_unlinked_attachments');
function asp_results_remove_unlinked_attachments($results) {
    foreach ($results as $k=>&$r) {
       $results[$k]->title = $r->post_type;
    }
    return $results;	
}

It shouldn’t be ‘attachment’, but something else (?).