Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 从以特定字符开头的帖子查询帖子ID_Wordpress - Fatal编程技术网

Wordpress 从以特定字符开头的帖子查询帖子ID

Wordpress 从以特定字符开头的帖子查询帖子ID,wordpress,Wordpress,我试图从我的数组中查询以特定字母开头的帖子 以下是我的想法: $first_char = array('1','2','3','4','5','6','7','8','9','0'); $postids = $wpdb->get_col($wpdb->prepare(" SELECT ID FROM $wpdb->posts WHERE SUBS

我试图从我的数组中查询以特定字母开头的帖子

以下是我的想法:

$first_char = array('1','2','3','4','5','6','7','8','9','0');

$postids = $wpdb->get_col($wpdb->prepare("
                SELECT      ID
                FROM        $wpdb->posts
                WHERE       SUBSTR($wpdb->posts.post_title,1,1) IN (%s)
                ORDER BY    $wpdb->posts.post_title",$first_char));
然后,我的WP查询如下所示:

$the_query = new WP_Query( array(       
 'post__in' => $postids,
        ));
但由于某些原因,$postid只返回$first_char数组中第一个字符的值