Last active
February 8, 2022 05:45
-
-
Save jaredatch/8610187 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Disable the "foo" custom post type feed | |
* | |
* @since 1.0.0 | |
* @param object $query | |
*/ | |
function ja_disable_cpt_feed( $query ) { | |
if ( $query->is_feed() && in_array( 'foo', (array) $query->get( 'post_type' ) ) ) { | |
die( 'Feed disabled' ); | |
} | |
} | |
add_action( 'pre_get_posts', 'ja_disable_cpt_feed' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Our custom post slug is templates. I've added the following to our child theme's functions.php, but the CPT feed is still there.
I've resaved the Permalinks, and the issue remains.
Help appreciated.