Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //function to modify default WordPress query
- function king_custom_query( $query ) {
- // Make sure we only modify the main query
- if( $query->is_main_query() && ! is_admin() && $query->is_archive() ) {
- // Set parameters to modify the query
- $query->set( 'orderby', 'title' );
- $query->set( 'order', 'ASC' );
- $query->set( 'suppress_filters', 'true' );
- }
- }
- // Hook our custom query function to the pre_get_posts
- add_action( 'pre_get_posts', 'king_custom_query' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement