Forums

query_posts() clobbers get_query_var() (1 post)

  1. ndnichols
    Member
    Posted 2 years ago #

    I'm new to WP, so maybe this is expected, but it seems weird to me that using query_posts before get_query_var seems to not work correctly.

    This code:

    query_posts('posts_per_page=-1');
    $nn_lat = get_query_var('nn_lat');
    $nn_lon = get_query_var('nn_lon');

    always returns the empty string from get_query_var while this code

    $nn_lat = get_query_var('nn_lat');
    $nn_lon = get_query_var('nn_lon');
    query_posts('posts_per_page=-1');

    works correctly.

    Is that the intended behavior?

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by ndnichols
  • This topic is not a support question
  • WordPress version: 2.9.1