Using WordPress ‘feed_links_extra_show_tag_feed’ PHP filter

The feed_links_extra_show_tag_feed WordPress PHP filter allows you to control the display of the tag feed link.

Usage

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

Parameters

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

More information

See WordPress Developer Resources: feed_links_extra_show_tag_feed

Examples

To hide the tag feed link on all pages of your website:

add_filter('feed_links_extra_show_tag_feed', 'hide_tag_feed_link');
function hide_tag_feed_link($show) {
  return false;
}

Show tag feed link only on single post pages

To display the tag feed link only on single post pages:

add_filter('feed_links_extra_show_tag_feed', 'show_tag_feed_on_single_post');
function show_tag_feed_on_single_post($show) {
  if (is_single()) {
    return true;
  }
  return false;
}

To hide the tag feed link on specific tag pages, replace TAG_ID with the desired tag ID:

add_filter('feed_links_extra_show_tag_feed', 'hide_tag_feed_for_specific_tag');
function hide_tag_feed_for_specific_tag($show) {
  if (is_tag('TAG_ID')) {
    return false;
  }
  return $show;
}

To display the tag feed link only for logged-in users:

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

Show tag feed link only on specific post types

To display the tag feed link only on specific post types, replace POST_TYPE with the desired post type:

add_filter('feed_links_extra_show_tag_feed', 'show_tag_feed_for_specific_post_type');
function show_tag_feed_for_specific_post_type($show) {
  if (is_singular('POST_TYPE')) {
    return true;
  }
  return false;
}