Speed up your Oxygen workflow

with Hydrogen Pack

A true Oxygens Editor Enhancer
Starts from $19.99

Limit search to post type

If you need to display only certain post type ( page, post, custom post) you need to add this to function.php

function searchfilter($query) {
 
    if ($query->is_search && !is_admin() ) {
        $query->set('post_type',array('post','page'));
    }
 
return $query;
}
 
add_filter('pre_get_posts','searchfilter')

On line 4 change what post type you need.

Source: https://www.wpbeginner.com/wp-tutorials/how-to-limit-search-results-for-specific-post-types-in-wordpress/

If you need help with custom scripts or you are not skilled enough to implement something from the tutorial?

HIRE ME

Stay up to date with latest post and updates.