ControlledChaos
8/7/2017 - 10:44 PM

Order post type archive pages by menu order for use with sort order plugins.

Order post type archive pages by menu order for use with sort order plugins.

<?php

function ccd_query_vars( $query ) {
	if ( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'post_type_slug' ) ) {
		$query->set( 'orderby', 'menu_order' );
		$query->set( 'order', 'ASC' );

		return $query;
	}
	return $query;
}
add_action( 'parse_query', 'ccd_query_vars' );

?>

Menu Order Archives

WordPress Snippet