Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在我的帖子标题中为单词的一部分做一个搜索,像这样
$args = array ( 'category_name' => '%som%'); query_posts( $args );
所以我得到了这个“东西”和“besomer”
我怎样才能做到这一点?
看起来 wordpress 默认已经这样做了。但是,您可以过滤posts_where以更改默认搜索功能。看起来像这样:
posts_where
<?php add_filter('posts_where', 'my_search_where'); function my_search_where($where) { if (is_search()) { // change the where string with a preg_replace() } return $where; } ?>