WordPressで「register_post_type」で作ったあるカスタム投稿タイプをサイト内の検索結果に表示させたくないことがあって、そんな時は「exclude_from_search」を引数の配列に設定してあげるとOKです。 ‘exclude_from_search’ => true 検索結果に表示させない‘exclude_from_search’ => false 検索結果に表示する「true」と「false」で上記の意味になります。 使い方例「spot」というカスタム投稿タイプを検索結果に表示させたくない場合、下のように「exclude_from_search」を使います。 <?php add_action( 'init', 'add_custompost' ); function add_custompost() { register_post_type( 'spot',
![WordPressで特定のカスタム投稿タイプをサイト内の検索結果に表示させない方法|今村だけがよくわかるブログ](https://cdn-ak-scissors.b.st-hatena.com/image/square/32643f6ae5e48aea8c177d7abf4485e0833af581/height=288;version=1;width=512/https%3A%2F%2Fi0.wp.com%2Fwww.imamura.biz%2Fblog%2Fwp-content%2Fuploads%2Ffeaturedwp.png%3Ffit%3D700%252C420%26ssl%3D1)