我想检索所有帖子和ID大于160的相对标签。
我试过:
\'$args=array(
\'post_type\' => \'post\',
\'post_status\' => \'publish\',
\'posts_per_page\' => 5,
\'orderby\'=> \'ID\',
\'order\' => \'desc\',
\'meta_query\' => array(
array(
\'key\' => \'ID\',
\'value\' => \'160\',
\'type\' => \'numeric\',
\'compare\' => \'>\',
),
),
);
$the_query = new WP_Query( $args );
也尝试过
$querystr = "
SELECT $wpdb->posts.*
FROM $wpdb->posts, $wpdb->postmeta
WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
AND $wpdb->postmeta.meta_key = \'tag\'
AND $wpdb->posts.post_status = \'publish\'
AND $wpdb->posts.post_type = \'post\'
AND $wpdb->posts.ID > 160
ORDER BY $wpdb->posts.post_date DESC
";
$pageposts = $wpdb->get_results($querystr);
if ($pageposts): ?>
<?php global $post; ?>
<?php foreach ($pageposts as $post): ?>
<?php setup_postdata($post); ?>
....