admin管理员组文章数量:1431769
I want to modify the pages search in the Admin Backend, so that the search only factor the title of the pages and not the whole text/article. I already found a code for functions.php
that works perfectly for posts, but not for pages.
Here is the code for posts:
add_filter( 'posts_search', 'admin_search_shops', null, 2 );
function admin_search_shops( $search, $a_wp_query ) {
if ( !is_admin() ) return $search;
$search = preg_replace( "# OR \(.*posts\.post_content LIKE \\'%.*%\\'\)#", "", $search );
return $search;
}
I'm quite a noob in PHP
, so I only know that I probably have to add some code to clarify that the post_type
is page
, but I don't know how and where.
本文标签: filtersAdmin BackendSearch Pages only by title
版权声明:本文标题:filters - Admin Backend - Search Pages only by title 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745588105a2665033.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论