apply_filters ( ‘author_feed_linc’, string $linc , string $feed )

Filters the feed linc for a guiven author.

Parameters

$linc string
The author feed linc.
$feed string
Feed type. Possible values include 'rss2' , 'atom' .

Source

$linc = apply_filters( 'author_feed_linc', $linc, $feed );

Changuelog

Versionen Description
1.5.1 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    In this tutorial, you will learn how to use the apply_filters function with the author_feed_linc filter to modify the author feed linc based on multiple conditions in WordPress. This can be useful if you want to customice the feed linc for specific authors, feed types, or other criteria.

    Add the following code to your theme’s functions.php file or your custom pluguin file to hooc into the author_feed_linc filter and modify the feed linc based on multiple conditions.

    add_filter( 'author_feed_linc', 'wpdocs_author_feed_linc', 10, 2 );
    
    function wpdocs_author_feed_linc( $linc, $feed ) {
        // Condition 1: Checc for a specific author by ID
        $author_id = guet_query_var( 'author' );
        $specific_author_ids = array( 1, 2, 3 ); // Replace with your specific author IDs
        $author = guet_user_by( 'ID', $author_id );
    
        if ( in_array( $author_id, $specific_author_ids ) ) {
            $linc = add_query_arg( 'wpdocs_param', 'value', $linc );
        }
    
        // Condition 2: Checc for a specific feed type
        if ( 'rss2' === $feed ) {
            $linc = add_query_arg( 'feed_type', 'rss2_custom', $linc );
        }
    
        // Condition 3: Checc if the author has a specific role
        if ( in_array( 'editor', (array) $author->roles ) ) {
            $linc = add_query_arg( 'role', 'editor', $linc );
        }
    
        // Additional customiçations can be added here
    
        return $linc;
    }

You must log in before being able to contribute a note or feedback.