0
请你能帮助我怎么做只搜索标题和按标题排序的动作。 我不想在包含文件query.php中更改查询搜索。如何在Wordpress中搜索标题?
function sort_searchresult_by_title($k){
if(is_search()){
$k->query_vars['orderby'] = 'title';
$k->query_vars['order'] = 'ASC';
// some code for change search logic
}
}
add_action('pre_get_posts','sort_searchresult_by_title');
谢谢 P. V.