正如标题所示,我正试图通过它找到一个帖子post_content.我该怎么做?谢谢
例: SELECT * FROM DBname WHERE post_content LIKE '%phrase%'
max*_*eni 10
或者,(并且因为它已被指定)你可以通过实际使用"WP_Query"类来实现这一点:
// The Query
$my_query = new WP_Query( array(
'post_type' => 'post',
's' => 'phrase'
));
// The Loop
while ( $my_query->have_posts() ) {
$my_query->the_post();
get_content();
//...
}
Run Code Online (Sandbox Code Playgroud)
像这样的东西?
$result = $wpdb->get_results( "SELECT * FROM wp_posts WHERE post_content LIKE '%phrase%'" );
if ($result){
foreach($result as $pageThing){
echo $pageThing->post_content;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9450 次 |
| 最近记录: |