Query does not return content

You shouldn’t be using query_posts() here, but rather WP_Query(). (Search WPSE for query_posts if you want to know wy.) <?php $custom_query_args = array( ‘post_type’ => ‘page’, ‘post_parent’ => ’50’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘posts_per_page’ => ‘100’ ); $custom_query = new WP_Query( $custom_query_args ); // To see the contents of the … Read more

Syntax help needed: Taxonomy Query

first of all, let’s just forget query_posts exists. there’s no good reason to use it, ever. the best way to do this is via the pre_get_posts action in your theme’s functions.php. you don’t have to set any taxonomy parameters, those are already set on a taxonomy archive page, you just need meta key and orderby: … Read more

Restrict query to last day with posts

You need to find the most recent date with posts and use that to construct the $current_ fields. $last_date = $wpdb->get_var(“SELECT DATE(MAX(post_date)) FROM {$wpdb->posts} LIMIT 1”); if (!empty($last_date)) { list($current_year,$current_month,$current_day) = explode(‘-‘,$last_date); query_posts( “cat=5&year=$current_year&monthnum=$current_month&day=$current_day&order=ASC” ); }

How to check the array values, what WP_Query has brought to me?

Assuming you start with: $custom_query_args = array( ‘cat’ => 10, ‘post_per_page’ => 5 ); $custom_query = new WP_Query($custom_query_args); Then to answer your first question, you can see what is returned (for development/debugging) via: var_dump( $custom_query ); To output your query as a normal loop, you simply need to call a custom loop, using the have_posts() … Read more

Why posts array is empty?

You don’t need to add the % signs to the value. WordPress does that for you automatically on a LIKE or NOT LIKE comparison. You also don’t need to “sanitize” the parameter, it will be automatically escaped for SQL. See wp-includes/meta.php, around line 806 or so.