query_posts and get_posts return different results
-
Hi everyone thanks for all your help.
I am attempting to modify my template to display different sets of posts based on the GET data sent to my page. This is an extract of the code I’m using
if ($_GET['test']!="") { query_posts('meta_key=author'); } else { query_posts('category_name=Online Courses'); }
When there is no GET value for “test”, the page works fine, the posts from category Online Courses are loaded and properly display in the loop below.
When “test” is specified, the code returns an empty result set. When I replace
query_posts('meta_key=author');
with
get_posts('meta_key=author');
and print the output, I can see that get_posts is returning the proper result set.
Any ideas? I am using the exact same parameters on both get_posts and query_posts, but one returns the proper set and one returns an empty set.
Thanks in advance!
- The topic ‘query_posts and get_posts return different results’ is closed to new replies.