如何使用WP_Query按post_excerpt进行过滤

时间:2012-05-01 20:33:43

标签: wordpress

$loop = new WP_Query( array(
    'post_type' => 'portfolio',
    'paged' => $paged,
    'posts' => array(
        'post_excerpt' => 'ba'
    )
));

这不适合我。

1 个答案:

答案 0 :(得分:1)

我试过这个解决方案:

global $wpdb;
$querystr = "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_excerpt = {$code}' AND $wpdb->posts.post_type = 'product'";     
$posts = $wpdb->get_results($querystr);