Skip to content

Instantly share code, notes, and snippets.

@tylerdigital
Created December 31, 2014 20:43
Show Gist options
  • Save tylerdigital/c127ae0c33f456b1f6c6 to your computer and use it in GitHub Desktop.
Save tylerdigital/c127ae0c33f456b1f6c6 to your computer and use it in GitHub Desktop.
Fix WordPress Hierarchical Post Performance Issue
add_action( 'pre_get_posts', array( $this, 'fix_hierarchy_performance_issue' ) );
function fix_hierarchy_performance_issue( $query ) {
if ( $query->query['post_type']=='hotspot' && $query->query['orderby']=='menu_order title' ) {
$query->set( 'orderby', 'menu_order title post_name' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment