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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745588105a4634667.html
评论列表(0条)