Answers for "wp order archive page post by title"

PHP
0

wp order archive page post by title

// Sort All Tours by Title
add_filter( 'parse_query', 'sorting_archives' );
function sorting_archives( $wp_query ) {
  if (is_post_type_archive( 'tour' ) || is_tax()) {
    $wp_query->set( 'orderby', 'title' );
    $wp_query->set( 'order', 'ASC' );
  }
  return $wp_query;
}
Posted by: Guest on July-01-2020

Browse Popular Code Answers by Language