Created
June 15, 2020 16:30
-
-
Save jchristopher/a1136cd5e05268c4a706b8498813b6e8 to your computer and use it in GitHub Desktop.
Add private Custom Post Types to SearchWP.
This file contains hidden or 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 | |
// Add private Custom Post Types to SearchWP. | |
add_filter( 'searchwp\sources', function( $sources ) { | |
// Create a Source from each private CPT e.g. | |
$sources[] = new \SearchWP\Sources\Post( 'my_private_cpt_name_1' ); | |
$sources[] = new \SearchWP\Sources\Post( 'my_private_cpt_name_2' ); | |
$sources[] = new \SearchWP\Sources\Post( 'my_private_cpt_name_3' ); | |
return $sources; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment