Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Changes Event Espresso venues sort order to order by title (name). Also, removes pagination for venue post type archives.
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter('pre_get_posts', 'order_venue_archive_by_title');
function order_venue_archive_by_title($query) {
if ( $query->is_archive &&
isset($query->query['post_type']) &&
$query->query['post_type']== 'espresso_venues' )
$query->set('orderby', 'title');
$query->set('order', 'ASC');
// remove pagination
$query->set('posts_per_page', -1);
return $query;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.