从wp查询中排除具有特定标题post_title的帖子

时间:2018-08-06 17:49:22

标签: wordpress

如何排除标题中包含特定单词的帖子。

我需要类似的东西:

$args = array(
    's' => 'title' // i need something that will exclude this "!title"

带有's'的我可以搜索带有该标题的帖子,但我需要排除它而不显示它!

或类似的东西

$wpdb->posts.post_title LIKE **NOT** '%Exclude this%'

不喜欢,我需要类似的东西。

1 个答案:

答案 0 :(得分:0)

非常容易,只需在标题前面添加-即可将其排除

$args = array(
's' => '-title' // will exclude all post with the title name "title"
相关问题