Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Display Alphabetical Order
<?php
function my_function() {
if ( is_category() && $query->is_main_query() ) {
$query->set( 'orderby', 'title');
$query->set( 'order', 'ASC' );
return $query;
}
}
add_action( 'pre_get_posts', 'my_function');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment