我使用的是下面放置一个滑块革命英雄滑块上的搜索表单。但是它搜索整个网站。我会把它想在我的网站只搜索页面。任何想法我需要改变,以使这项工作?
添加这一功能
function wpshock_search_filter( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', array('post','page') );
}
return $query;
}
add_filter('pre_get_posts','wpshock_search_filter');
或者您也可以使用这个插件https://wordpress.org/plugins/relevanssi/
我希望它为你工作。