[wp-hackers] WP_Query and orderby - outside of WP
dennen at gmail.com
Mon May 14 15:55:50 UTC 2012
I have a regular PHP script that bootstraps WordPress by including
wp-load.php (as previously discussed on this list).
I'm doing something relatively simply --
a) loading WP
b) grabbing posts of a certain custom post type
I'd like to change the orderby, but no matter what I pick for orderby,
the posts come back in the same order (ie. date).
Here's my code:
global $wp_the_query, $wp_query, $wp_rewrite, $wp;
$quilts = new WP_Query('post_type=profiles&post_status=publish&orderby=rand' );
while ( $quilts->have_posts() ) : $quilts->the_post();
In short, changing the orderby parameter has no effect. ie. title, rand, etc.
What could be causing this? Might it have to do with bootstrapping WP
in this way?
More information about the wp-hackers