Register CPT UI to frontend search
-
Dear support is it possible to register CPTs to frontend search? We used this functions.php code, but it causes backend errors with backend search of wordpress.
function my_cptui_add_post_type_to_search( $query ) { if ( $query->is_search() ) { // Replace these slugs with the post types you want to include. $cptui_post_types = array( 'mitarbeiter', 'referenzen', 'infothekbeitrag', 'partner', 'referenzbericht', 'jobboerse' ); $query->set( 'post_type', array_merge( array( 'post' ), $cptui_post_types ) ); } } add_filter( 'pre_get_posts', 'my_cptui_add_post_type_to_search' );
Is there a way to avoid backend search problems while registering to frontend search?
Thanks in advance Marc
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Register CPT UI to frontend search’ is closed to new replies.