The feed_links_extra_show_search_feed WordPress PHP filter lets you control the display of the search results feed link.
Usage
add_filter('feed_links_extra_show_search_feed', 'your_custom_function'); function your_custom_function($show) { // your custom code here return $show; }
Parameters
$show
(bool) – Whether to display the search results feed link. Default true.
More information
See WordPress Developer Resources: feed_links_extra_show_search_feed
Examples
Hide the search results feed link
Hide the search results feed link for your website.
add_filter('feed_links_extra_show_search_feed', 'hide_search_results_feed_link'); function hide_search_results_feed_link($show) { return false; }
Show search results feed link only for logged-in users
Display the search results feed link only for logged-in users.
add_filter('feed_links_extra_show_search_feed', 'search_feed_for_logged_in_users'); function search_feed_for_logged_in_users($show) { if (is_user_logged_in()) { return true; } return false; }
Show search results feed link only on specific pages
Display the search results feed link only on specific pages by checking the page ID.
add_filter('feed_links_extra_show_search_feed', 'search_feed_on_specific_pages'); function search_feed_on_specific_pages($show) { if (is_page(array(10, 20, 30))) { return true; } return false; }
Show search results feed link only for specific categories
Display the search results feed link only for specific categories by checking the category ID.
add_filter('feed_links_extra_show_search_feed', 'search_feed_for_specific_categories'); function search_feed_for_specific_categories($show) { if (is_category(array(2, 5, 7))) { return true; } return false; }
Show search results feed link only for specific post types
Display the search results feed link only for specific post types.
add_filter('feed_links_extra_show_search_feed', 'search_feed_for_specific_post_types'); function search_feed_for_specific_post_types($show) { if (is_post_type_archive('your_custom_post_type')) { return true; } return false; }
END