• Resolved SRD75

    (@srd75)


    The affected page is of a custom post type.

    In the source code of the affected page, I see:

    <link rel="alternate" type="application/rss+xml" title="Mandoe &raquo; Feed" href="https://mandoemedia.com/feed/" />
    <link rel="alternate" type="application/rss+xml" title="Mandoe &raquo; Comments Feed" href="https://mandoemedia.com/comments/feed/" />
    <link rel="alternate" type="application/rss+xml" title="Mandoe &raquo; Vitamin Discount Promotion Template Comments Feed" href="https://mandoemedia.com/templates/medical/pharmacies/vitamin-discount-promotion-template/feed/" />

    Note that https://mandoemedia.com/templates/medical/pharmacies/vitamin-discount-promotion-template/feed/ doesn’t exist.

    How do I disable /feed/ for the CPT?

    Thanks.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter SRD75

    (@srd75)

    This is our code:

    function post_type_discog1() {
    
    register_post_type('templates',
        array(
        'labels' => array(
                'name' => __( 'Templates' ),
                'singular_name' => __( 'Template' ),
                'add_new' => __( 'Add New' ),
                'add_new_item' => __( 'Add New Template' ),
                'edit' => __( 'Edit' ),
                'edit_item' => __( 'Edit Template' ),
                'new_item' => __( 'New Template' ),
                'view' => __( 'View Template' ),
                'view_item' => __( 'View Template' ),
                'search_items' => __( 'Search Templates' ),
                'not_found' => __( 'No Templates found' ),
                'not_found_in_trash' => __( 'No Templates found in Trash' ),
                'parent' => __( 'Parent Templates' ),
            ),
      'public' => true,
      'show_ui' => true,
            'exclude_from_search' => true,
            'hierarchical' => true,
            'supports' => array( 'title', 'editor', 'thumbnail','page-attributes' ),
            'query_var' => true
            )
      );
    }
    add_action('init', 'post_type_discog1');
    
    add_action( 'init', 'create_discog_taxonomies', 0 );
    
    function create_discog_taxonomies()
    {
      // Add new taxonomy, make it hierarchical (like categories)
      $labels = array(
        'name' => _x( 'Template Categories', 'taxonomy general name' ),
        'singular_name' => _x( 'Category', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Template Categories' ),
        'popular_items' => __( 'Popular Template Categories' ),
        'all_items' => __( 'All Template Categories' ),
        'parent_item' => __( 'Parent Template Category' ),
        'parent_item_colon' => __( 'Parent Template Category:' ),
        'edit_item' => __( 'Edit Template Category' ),
        'update_item' => __( 'Update Template Category' ),
        'add_new_item' => __( 'Add New Template Category' ),
        'new_item_name' => __( 'New Template Category Name' ),
      );
      register_taxonomy('templatecategory',array('templates'), array(
        'hierarchical' => true,
        'labels' => $labels,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'templates-category' ),
      ));
    }
    Thread Starter SRD75

    (@srd75)

    I tried using:

    register_post_type('templates',
        array(
        'labels' => array(
                'name' => __( 'Templates' ),
                'singular_name' => __( 'Template' ),
                'add_new' => __( 'Add New' ),
                'add_new_item' => __( 'Add New Template' ),
                'edit' => __( 'Edit' ),
                'edit_item' => __( 'Edit Template' ),
                'new_item' => __( 'New Template' ),
                'view' => __( 'View Template' ),
                'view_item' => __( 'View Template' ),
                'search_items' => __( 'Search Templates' ),
                'not_found' => __( 'No Templates found' ),
                'not_found_in_trash' => __( 'No Templates found in Trash' ),
                'parent' => __( 'Parent Templates' ),
            ),
      'public' => true,
      'feeds' => null,
      'show_ui' => true,
            'exclude_from_search' => true,
            'hierarchical' => true,
            'supports' => array( 'title', 'editor', 'thumbnail','page-attributes' ),
            'query_var' => true
            )
      );
    }

    (note the added 'feeds' => null,, but this does not resolve the issue).

    Thread Starter SRD75

    (@srd75)

    From the register_post_type function reference, I tried replacing

    'feeds' => null,

    with

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

    but the /feed/ remained.

    • This reply was modified 4 years, 4 months ago by SRD75.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    According to the documentation, the feeds portion of rewrite should be boolean, so try 'rewrite' => array('feeds' => false)

    Thread Starter SRD75

    (@srd75)

    Thanks, @tw2113, I made that change but the extra feed remains.

    There is no WP caching installed.

    Thread Starter SRD75

    (@srd75)

    I also resaved Permalinks, and the issue remains.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not sure how much you’re willing to remove from these, but perhaps something like outlined in https://kinsta.com/knowledgebase/wordpress-disable-rss-feed/ or perhaps remove_theme_support() paired with “automatic-feed-links”

    Thread Starter SRD75

    (@srd75)

    We’d prefer to keep those feeds

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not sure what’s going on at this point and how to get rid of just the one.

    Thread Starter SRD75

    (@srd75)

    It turned out our SEO manager was happy with the category feeds being removed, so we used:

    remove_action( 'wp_head', 'feed_links_extra', 3 );

    from the link you provided. This solved the problem for us. Thanks.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘disable /feed for custom post type’ is closed to new replies.