Forums

Question About get_posts Parameters (2 posts)

  1. jtrost
    Member
    Posted 1 year ago #

    Let's say I have a WordPress site with 10 posts and I want to find what posts are tagged "news". However, I only want to look for the tag in posts 1, 2, 3, 4, 5, and 6. I don't care about posts 7, 8, 9, and 10. Will these arguments return ONLY posts tagged "news" in the collection of posts I specified?

    $args = array(
    "tag" => "news",
    "include" => "1,2,3,4,5,6"
    );

    As a follow up, what if I have a collection of 50 posts and 10 tags? Are there any performance issues I need to be aware of when using $args with very specific parameters?

  2. MichaelH
    Volunteer
    Posted 1 year ago #

    $args = array(
      'tag' => 'news',
      'post__in' => array(1,2,3,4,5,6),
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1
    );

    Don't know the answer to your follow-up

    Related:
    http://codex.wordpress.org/Template_Tags/query_posts

Topic Closed

This topic has been closed to new replies.

About this Topic