Exciting News! Flipper Code is now WePlugins! Same commitment to excellence, brand new identity.

How to use post_type_archive_feed_link filter in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
January 17, 2023
5 minutes read

post_type_archive_feed_link filter

Filters the post type archive feed link.

apply_filters( 'post_type_archive_feed_link', string $link, string $feed )

Access Premium WordPress Plugins

Description

This is a filter hook. It filters the post type archive feed link. It consists of two parameters: one is $link, the 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 Examples

Basic Usage

To run the hook, copy the example below.

    $link = apply_filters( 'weplugins_post_type_archive_feed_link', $link, $feed ); 
                         
    if ( !empty( $link ) ) { 
        // everything has led up to this point... 
    } 
    

Adding a Hook Callback

The following example is for adding a hook callback.

    // define the weplugins_post_type_archive_feed_link callback 
    function weplugins_filter_post_type_archive_feed_link( $link, $feed ) { 
        // make filter magic happen here... 
        return $link; 
    }; 
         
    // add the filter 
    add_filter( 'weplugins_post_type_archive_feed_link', 'weplugins_filter_post_type_archive_feed_link', 10, 2 ); 
    

Removing a Hook Callback

To remove a hook callback, use the example below.

    // remove the filter 
    remove_filter( 'weplugins_post_type_archive_feed_link', 'weplugins_filter_post_type_archive_feed_link', 10, 2 ); 
    

Contact Us

If you need customization, feel free to contact us.

Sandeep Kumar Mishra

Sandeep Kumar Mishra

Sandeep Kumar Mishra writes about WordPress and Artificial Intelligence, offering tips and guides to help you master your website and stay updated with the latest tech trends.

Explore the latest in WordPress

Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.