הסניפט הבא מאפשר לכם להגביל את החיפוש בוורדפרס לסוג תוכן ספציפי (Custom Post Types) כך שיתקבלו תוצאות אך ורק מסוג תוכן זה. הוסיפו ל functions.php
וקבעו בשורה מספר 4 את סוג או סוגי התוכן עליהן יתבצע החיפוש.
function SearchFilter($query) {
if ($query->is_search) {
// Insert the specific post type you want to search
$query->set('post_type', 'feeds');
}
return $query;
}
// This filter will jump into the loop and arrange our results before they're returned
add_filter('pre_get_posts','SearchFilter');