WP_Query order by date in meta_value

change your args as bellow $args = array( ‘post_type’ => ‘your_post_type’, ‘orderby’ => ‘meta_value’, ‘meta_query’ => array(array(‘key’ => ‘releaseDate’)), ‘order’ => ‘ASC’, ‘paged’ =>$paged, ); If you get the results ordered other way around, change ‘order’ => ‘DESC’, You’ll get the correct order.

Get rewrite result

Have a look at the Action Reference to see generally how requests are processed. After all the loading and init stuff happens, the parse_request action runs when the request is matched against the rewrite rules, and an object is passed containing all the registered query vars and the matched rule and query string. function wpd_parse_request( … Read more

Select random post every day

Note that the posts_orderby filter is not available for get_posts() where suppress_filters is true by default. You can use WP_Query instead: $args = [ ‘posts_per_page’ => 1, ‘orderby’ => ‘rand’, ‘post_type’ => ‘listing’, ‘ignore_sticky_posts’ => true, ]; add_filter( ‘posts_orderby’, ‘force_random_day_seed’ ); $q = new WP_Query( $args ); remove_filter( ‘posts_orderby’, ‘force_random_day_seed’ ); if( $q->have_posts() ) { … Read more

Ignore/Skip default value on orderby menu_order?

You can try the following (untested) mini plugin: <?php /** * Plugin Name: Support for ignoring the default menu order in WP_Query * Description: Uses the _ignore_default_menu_order argument * Plugin URI: http://wordpress.stackexchange.com/a/193291/26350 */ add_filter( ‘posts_where’, function( $where, $q ) { global $wpdb; if( (bool) $q->get( ‘_ignore_default_menu_order’ ) ) { $where .= “AND {$wpdb->posts}.menu_order <> 0”; … Read more

Filter user list that meta_value is empty

I think the use of meta_query is in order: $user_query = new WP_User_Query( array( ‘meta_query’=> array( array( ‘key’=> ‘birthday’, ‘compare’ => ‘NOT EXISTS’ ) ) ) ); Basically, this looks for all users where the meta key of birthday doesn’t have a value ie doesn’t exist. More info about meta queries in WP_User_Query can be … Read more

Array Chunks and Inserting Varying HTML in WP_Query

That’s a pretty complicated approach you’re taking. Why not simply add a counter? Like this: $i=1; echo ‘<div class=”row full”>’; if( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); if ($i < 3) $class = “large-6 medium-6 small-12 columns” else “large-4 medium-4 small-12 columns”; echo ‘<div class=”‘ . $class . ‘”>’ … output your … Read more

Is temporarily overwriting $wp_query a bad idea?

In general, I agree with Howdy_McGee that one should avoid overwriting the main query unless absolutely necessary – more often than not, modifying the main query with something like a ‘pre_get_posts’ hook is a better solution to such scenarios. Manually overwriting the global $wp_query can cause all sorts of unintended behaviors if you are not … Read more