• Resolved celine2609

    (@celine2609)


    Hello,

    WordPress creates RSS feeds automatically when we add a new taxonomy.

    For examples :

    http://www.tapenade.pro/pois-chiche-2017/feed/
    http://www.tapenade.pro/instruments-de-musique-ceramique/feed/
    http://www.tapenade.pro/cat/actualites/feed/

    I want to keep the main RSS feed which is:
    http://www.tapenade.pro/feed/

    I want to delete the RSS feed that automatically generates WordPress via the function.php.

    A function that would say “if you meet 1 RSS feed that is not http://www.tapenade.pro/feed/ then you delete”

    Do you know the php code to indicate please ?

    In the tutorial : http://www.wpbeginner.com/wp-tutorials/how-to-disable-rss-feeds-in-wordpress/
    the function.php is to disable all RSS feeds.

    A BIG THANK-YOU

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Have a look at Customizing Feeds. The suggested code for using a custom template can be used to screen and limit feed requests. If the ‘taxonomy’ query var exists, instead of getting a template, call wp_die() with an error message and a 404 response argument.

    You could go even farther by checking the requested URL in the $_SERVER array and if it’s not a generic all site feed request, call wp_die(). This will kill any feed but the main one, even the comments feed. Unless you also explicitly allow the comments feed request.

    Thread Starter celine2609

    (@celine2609)

    Hello

    Thank you very much for your reply.
    That’s a little bit difficult for me to understand.
    Sincerely

    Moderator bcworkz

    (@bcworkz)

    Adapting the Codex example:

    function my_custom_rss( $is_comment ) {
    	if ( '' != get_query_var( 'taxonomy' ) ) {
    		wp_die('A specific feed is not available, please subscribe to <a href="'. site_url('/feed/') .'">our general feed</a>');
    	} else {
    		load_template( ABSPATH . WPINC . '/feed-rss2.php' );
    	}
    }
    remove_all_actions( 'do_feed_rss2' );
    add_action( 'do_feed_rss2', 'my_custom_rss');

    This will kill any custom taxonomy feed requests.

    Thread Starter celine2609

    (@celine2609)

    Hello

    OK thank you very much 🙂
    Sincerely

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

The topic ‘Delete RSS feeds when adding a taxonomy’ is closed to new replies.