Skip to main content
3 events
when toggle format what by license comment
Apr 13, 2023 at 22:37 comment added user231567 I figued out the code and I got it work: function abc_search( $query ) { if( $query->is_search ) { $query->set( 'meta_key', 'expert_last_name' ); $query->set( 'orderby', 'meta_value' ); $query->set( 'order', 'ASC' ); } } add_filter( 'pre_get_posts','abc_search' );
Apr 13, 2023 at 18:33 comment added user231567 Thank you for the response! I appreciate the help. Unfortunately, we didn't want to go the user route and made each entry as a custom post type. I wouldn't have access to the surname option with the route we decided to go with. Would I be able to add more items to this line "$query->set( 'meta_key', 'last_name' );" that addresses the custom content field?
Apr 13, 2023 at 2:11 history answered popnoodles CC BY-SA 4.0