I want to remove the feeds for specific custom post types. Most recommended methods are not clean. There seems to be a option called $args->feeds but this does not work within the register_post_type() function.

   'rewrite' => array('slug' => 'slug/%term&', 
                      'with_front' => false,
                      'feeds' => false), // Remove feed rewrite-rules?

Source: Line 1324 - /wp-includes/post.php (Wordpress 3.5)

I'm looking for a solution, to disable the rule generation inside $wp_rewrite->rules.

  • hmm KISS is to leave the feeds. just remove them from the header and probably no one will subscribe to them. Mar 1, 2013 at 5:40

2 Answers 2


Taking a look at the register_post_type() function in WordPress source, it appears that WordPress uses isset() to check the feeds arg instead of empty(), meaning that a false value will return true. To fix this, you might try setting 'feeds' => null and then flush your rewrite rules from Settings > Permalinks (remember to do it TWICE, to get past a weird quirk).

Alternatively, you can shut down any other page (including feeds) before it has a chance to load...

function kill_feeds(){
    if ( is_feed( array('post','my-custom-type') ) ) {

What this should do is detect if the current request is a feed (of the specific post types you specify) and, if it is, stops any further output.

If you wanted to get really crazy, you could redirect to your sites 404 page instead. :-)

Finally, failing all that, you could modify your rewrite rules manually. The rewrite_rules_array filter exposes the entire rewrite rules array and you can work a little regex magic to remove any applicable feed rules. Assuming your post was 'foo', this might look like...

add_filter('rewrite_rules_array', 'kill_feed_rewrites');
function kill_feed_rewrites($rules){
    foreach ($rules as $rule => $rewrite) {
        if ( preg_match('/^foo.*(feed)/',$rule) ) {
    return $rules;

Feed reference, the rules themselves look something like this...

'foo/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => string 'index.php?attachment=$matches[1]&feed=$matches[2]'
  • 1
    returning 404 is not crazy but a must, otherwise you might have people subscribing to your feed and wasting your CPU time. Mar 1, 2013 at 5:39
  • That's a fairly cheap answer (first result from Google...) and does not prevent rewrite rule generation !
    – mate64
    Mar 1, 2013 at 8:27
  • 3
    I added some additional approaches. Also, telling volunteers that their freely offered help is "cheap" might not be the best way to get help in the future. Mar 2, 2013 at 17:13
  • Hi @MattvanAndel, I have tried 'feeds' => null. 'feeds' => false, 'feeds' => true and all 3 fail to remove the feed from our custom post type. I have. a question here.
    – Steve
    Feb 8, 2022 at 1:32

Had to do this for one of my sites, I can confirm that this works.

In the CPT args

'rewrite' => array('feeds' => false ),

Keep in mind if you already have a rewrite arg you just need to add the , 'feeds' => false portion

For example

'rewrite' => array('slug' => 'your-slug', 'with_front' => false, 'feeds' => false ),

Here is the full args array for context (for any new comers, remember this is my args array for my CPT, your args may need to be different)

$post_type_args = array(
        'labels'                => $labels,
        'singular_label'        => __('Your Label'),
        'public'                => true,
        'show_ui'               => true,
        'publicly_queryable'    => true,
        'query_var'             => true,
        'exclude_from_search'   => false,
        'show_in_nav_menus'     => false,
        'capability_type'       => 'post',
        'has_archive'           => true,
        'hierarchical'          => false,
        'rewrite'               => array('slug' => 'your-slug', 'with_front' => false, 'feeds' => false ),
        'supports'              => array('title', 'editor', 'thumbnail','page-attributes'),
        'menu_position'         => 50,
        'menu_icon'             => 'dashicons-star-filled',
        'taxonomies'            => array('your_taxonomy')

Hope this helps you or anyone else looking to do this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.