I’ve created a set of arguments for my WP_Query as to create an order of posts on my page, sorted by date: $args = array( ‘post_type’ => ‘position’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘end_date’, ‘order’ => ‘desc’, ‘author’ => $current_user->ID, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘is_active’, ‘value’ => ‘true’ ) ) ); It works nicely, except for some of my posts the meta_key ‘end_date’ is not set, as to display an ongoing position, e.g.: June 2017 – June 2018 February 2014 – July 2017 January 2018 – Now September 2018 – Now My issue is, because the end_date is null, the posts are pushed to the bottom, where as I would like them in the top. It of course works if I change my order to ascending, but then the later end_date that isn’t null, will be in the bottom, while I still want to maintain the order of those elements as shown above. Is there some kind of filter I can create to solve this?
- Alleged Breach of Implied-in-Fact Contract for Use of a Television Show Idea Not Preempted by Copyright Act
- Bombay HC Directs I&B Ministry To Consider Telling Media Not To Use Word ‘Dalit’ In News Reports [Read Order]
- SC Orders Auditing Of All NGOs; Directs Action Against Defaulters [Read Order]
- After reunification deadline, some separated children and 'missing parents' remain
- State audit slams RTD bus, rail operators for using cellphones on job
- California Repeals Prohibition on Use of Alternative Currencies
- FDA Issues Draft Guidance Relevant to Use of Nanotechnology in Food and Food Packaging
- Court Stays Order Requiring Testimony on Prosecutor Firings
- Rescue and Recovery Work Necessary for Valid MSHA ‘j’ Order, Commission Rules
- Gina Haspel sought to withdraw nomination to be CIA director, Washington Post reports
Order posts with missing meta_key value differently than rest of the posts using WP_Query have 309 words, post on wordpress.stackexchange.com at April 4, 2019. This is cached page on Wordpress. If you want remove this page, please contact us.