Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

cpt ui plugin hidden single post type from search results in website

function my_cptui_add_post_type_to_search( $query ) {
	if ( is_admin() || ! $query->is_main_query() ) {
		return;
	}

	$query->set(
		'post_type',
		array( 'post', 'page', 'tour', 'struttura', 'offerta', 'project' )
	);
}

add_filter( 'pre_get_posts', 'my_cptui_add_post_type_to_search' );
Source by wordpress.org #
 
PREVIOUS NEXT
Tagged: #cpt #ui #plugin #hidden #single #post #type #search #results #website
ADD COMMENT
Topic
Name
6+6 =