WP_Query() works but ignores arguments, and WP_DEBUG doesn’t do anything
-
I am pretty new to WordPress, so perhaps I am overlooking something dumb. I have a custom page set up called Contents that lists all my posts. Works great. Text shown at end of this email. The problem is I need to change the orderby. I have tried every parameter under the sun, and any parameters to WP_Query() are always ignored, and no errors are reported.
I tried turning on debugging in my wp-config.php as shown below, but nothing happens, no errors or debug log produced. I am putting these files in the right places on my server and other changes are reflected fine, but parameters to WP_Query are ignored. Can you see what I am doing wrong? I tried remove_all_filters() on a recommendation; it had no effect. I have read the codex over and over and I can’t figure it out. Thanks!
Steve
enabling debugging doesn’t work:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'SCRIPT_DEBUG', true );
my page:
<?php /* Template Name: Contents */ ?> <?php get_header(); ?> <article> <?php $paged = 1; // remove_all_filters('posts_orderby'); $args = array('orderby' => 'rand'); // always ignored no matter what parameters I give $wp_query = new WP_Query( $args ); $wp_query->query('showposts=500' . '&paged='.$paged); while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <h3><a>" title="Read more"><?php the_title(); ?></a></h2> <?php endwhile; ?> <?php wp_reset_postdata(); ?> </article> <?php get_footer(); ?>
- The topic ‘WP_Query() works but ignores arguments, and WP_DEBUG doesn’t do anything’ is closed to new replies.