Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Ignore unlinked Attachments › Reply To: Ignore unlinked Attachments
March 8, 2019 at 3:37 pm
#21515
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 (?).