Last active
August 29, 2015 14:15
-
-
Save bhwebworks/bc84cbc4fbecf9696e96 to your computer and use it in GitHub Desktop.
Exclude Sensei lessons and courses from search results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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