Skip to content

Instantly share code, notes, and snippets.

@bhwebworks
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhwebworks/bc84cbc4fbecf9696e96 to your computer and use it in GitHub Desktop.
Save bhwebworks/bc84cbc4fbecf9696e96 to your computer and use it in GitHub Desktop.
Exclude Sensei lessons and courses from search results
<?php
// use the code below this comment
add_action( 'init', 'update_my_custom_type', 99 );
/**
* update_my_custom_type
*
* @author Joe Sexton <joe@webtipblog.com>
*/
function update_my_custom_type() {
global $wp_post_types;
if ( post_type_exists( 'lesson' ) ) {
// exclude from search results
$wp_post_types['lesson']->exclude_from_search = true;
}
if ( post_type_exists( 'course' ) ) {
// exclude from search results
$wp_post_types['course']->exclude_from_search = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment