post_type_archive_feed_link filter
Filters the post type archive feed link.
apply_filters( 'post_type_archive_feed_link', string $link, string $feed )
Description
This is filter hook , its filter the post type archive feed link.
Its consists of twp parameters, one is $link, second is $feed Type .
It is used in get_post_type_archive_feed_link() which retrieves the permalink for a post type archive feed.
Parameters
- $link : (string) The post type archive feed link.
- $feed : (string) Feed type. Possible values include ‘rss2’, ‘atom’.
Live Example
To run the hook, copy the example below.
$link = apply_filters( 'post_type_archive_feed_link', $link, $feed ); if ( !empty( $link ) ) { // everything has led up to this point... }
The following example is for adding a hook callback.
// define the post_type_archive_feed_link callback function filter_post_type_archive_feed_link( $link, $feed ) { // make filter magic happen here... return $link; }; // add the filter add_filter( 'post_type_archive_feed_link', 'filter_post_type_archive_feed_link', 10, 2 );
To remove a hook callback, use the example below.
// remove the filter remove_filter( 'post_type_archive_feed_link', 'filter_post_type_archive_feed_link', 10, 2 );