Last active
January 11, 2022 19:23
-
-
Save swissspidy/2d07e7e9de340709688bc90599ce7d7b to your computer and use it in GitHub Desktop.
Mini-plugin to include Web Stories in the built-in WordPress 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 | |
/** | |
* Plugin Name: Web Stories Force Include In Search | |
* Description: Web Stories are by default excluded from the built-in WordPress search results. This plugin includes stories again. | |
* Plugin URI: https://wp.stories.google/ | |
* Author: Pascal Birchler, Google | |
* Author URI: https://opensource.google.com/ | |
* Version: 0.0.1 | |
* License: Apache License 2.0 | |
* License URI: https://www.apache.org/licenses/LICENSE-2.0 | |
*/ | |
add_filter( | |
'register_post_type_args', | |
static function ( $args, $name ) { | |
if ( 'web-story' === $name ) { | |
$args['exclude_from_search'] = false; | |
} | |
return $args; | |
}, | |
10, | |
2 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment