/**
* Plugin Name: Exclude Tag from RSS Feed
* Description: Exclude posts with a specific tag from the RSS feed using the `n` parameter in the URL.
* Author: Your Name
* Version: 1.0
*/
add_action(‘pre_get_posts’, function ($query) {
if ($query->is_feed() && $query->is_main_query()) {
// Check if the ‘n’ parameter is set in the URL
if (isset($_GET[‘n’])) {
$excluded_tag = sanitize_text_field($_GET[‘n’]); // Sanitize the input
$tag = get_term_by(‘slug’, $excluded_tag, ‘post_tag’); // Get tag details
if ($tag) { // Ensure the tag exists
$query->set(‘tag__not_in’, array($tag->term_id)); // Exclude the tag
}
}
}
});