我正在尝试获取所有没有以aa\\uUket开头的元ket的帖子。我可以这样做
$args = array(
\'posts_per_page\' => -1,
\'category__in\' => 23,
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'key\' => \'aa_article_1\',
\'compare\' => \'NOT EXISTS\',
\'value\' => \'\'
),
array(
\'key\' => \'aa_article_2\',
\'compare\' => \'NOT EXISTS\',
\'value\' => \'\'
),
array(
\'key\' => \'aa_article_3\',
\'compare\' => \'NOT EXISTS\',
\'value\' => \'\'
),
array(
\'key\' => \'aa_article_4\',
\'compare\' => \'NOT EXISTS\',
\'value\' => \'\'
),
array(
\'key\' => \'aa_article_5\',
\'compare\' => \'NOT EXISTS\',
\'value\' => \'\'
),
array(
\'key\' => \'aa_article_6\',
\'compare\' => \'NOT EXISTS\',
\'value\' => \'\'
)
));
$the_query = new WP_Query ($args);
// The Loop
if ( $the_query->have_posts() ) {
echo \'<ul>\';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo \'<li><a href="\' . get_the_permalink() . \'" target="_blank">\' . get_the_title() . \'</a></li>\';
}
echo \'</ul>\';
echo "<h2>Found: $the_query->found_posts posts</h2>";
} else {
// no posts found
}
wp_reset_postdata();
有没有办法做到这一点?我有大约50个以aa\\u1开头的元密钥,这样可以节省一些时间。当然,很高兴知道是否有可能,以备将来使用:)