WordPress.org

Support

Support » How-To and Troubleshooting » Select posts of onyl one category

Select posts of onyl one category

  • Hi,
    in this query (of the xml export function):

    <?php if ($post_ids) {
              global $wp_query;
              $wp_query->in_the_loop = true;  // Fake being in the loop.
              // fetch 20 posts at a time rather than loading the entire table into memory
              while ( $next_posts = array_splice($post_ids, 0, 20) ) {
                $where = "WHERE ID IN (".join(',', $next_posts).")";
                $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
                  foreach ($posts as $post) {
                setup_postdata($post); ?>

    how to select only posts of the category who have the ID=3 ?

    ++

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Select posts of onyl one category’ is closed to new replies.