Using WordPress ‘feed_links_extra_show_tax_feed’ PHP filter

The feed_links_extra_show_tax_feed WordPress PHP filter allows you to control the display of custom taxonomy feed links on your website.

Usage

add_filter('feed_links_extra_show_tax_feed', 'my_custom_function');
function my_custom_function($show) {
    // your custom code here
    return $show;
}

Parameters

  • $show (bool): Whether to display the custom taxonomy feed link. Default is true.

More information

See WordPress Developer Resources: feed_links_extra_show_tax_feed

Examples

To hide all custom taxonomy feed links, return false in the filter function:

add_filter('feed_links_extra_show_tax_feed', 'hide_all_custom_tax_feeds');
function hide_all_custom_tax_feeds($show) {
    return false;
}

To hide custom taxonomy feed links for a specific taxonomy, check if the current taxonomy is the one you want to hide, then return false:

add_filter('feed_links_extra_show_tax_feed', 'hide_specific_custom_tax_feed', 10, 2);
function hide_specific_custom_tax_feed($show, $taxonomy) {
    if ($taxonomy == 'your_taxonomy_name') {
        return false;
    }
    return $show;
}

To show custom taxonomy feed links only for logged-in users, check if the user is logged in and return the appropriate value:

add_filter('feed_links_extra_show_tax_feed', 'show_tax_feed_for_logged_in_users');
function show_tax_feed_for_logged_in_users($show) {
    if (is_user_logged_in()) {
        return true;
    }
    return false;
}

Hide custom taxonomy feed links on specific post types

To hide custom taxonomy feed links on specific post types, check the current post type and return false if it matches the desired post type to hide:

add_filter('feed_links_extra_show_tax_feed', 'hide_tax_feed_on_specific_post_types', 10, 2);
function hide_tax_feed_on_specific_post_types($show, $taxonomy) {
    $post_type = get_post_type();
    if ($post_type == 'your_post_type') {
        return false;
    }
    return $show;
}

To show custom taxonomy feed links only on specific pages, check the current page and return true if it matches the desired page:

add_filter('feed_links_extra_show_tax_feed', 'show_tax_feed_on_specific_pages');
function show_tax_feed_on_specific_pages($show) {
    if (is_page('your_page_slug')) {
        return true;
    }
    return false;
}