Answers for "wp_query sort by date"

PHP
0

order by date wp php

$query = new WP_Query(array(
    'post_status' => 'publish',
    'orderby' => 'publish_date',
    'order' => 'DESC'
  ));
//DESC sorts by newest, ASC by oldest. GL fellow grepper user
Posted by: Guest on October-19-2020

Browse Popular Code Answers by Language