WordPress:如何在帖子中搜索“post_content"?使用“wp_query"班级? [英] WordPress: How search a post for "post_content" with "wp_query" class?
本文介绍了WordPress:如何在帖子中搜索“post_content"?使用“wp_query"班级?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
正如标题所暗示的,我试图通过它的 post_content
找到一个帖子.我该怎么做?谢谢
As the title suggests, I'm trying to find a post through its post_content
.
How can I do it?
Thanks
示例:SELECT * FROM DBname WHERE post_content LIKE '%phrase%'
推荐答案
类似的事情?
$result = $wpdb->get_results( "SELECT * FROM wp_posts WHERE post_content LIKE '%phrase%'" );
if ($result){
foreach($result as $pageThing){
echo $pageThing->post_content;
}
}
这篇关于WordPress:如何在帖子中搜索“post_content"?使用“wp_query"班级?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文