Skip to content

friends_override_author_name

Alex Kirk edited this page Apr 8, 2024 · 18 revisions

Allows overriding the authorname for a post.

Example:

add_filter( 'friends_override_author_name', function( $override_author_name, $author_name, $post_id ) {
    if ( ! $override_author_name ) { // Only override if not already overridden.
        $override_author_name = get_post_meta( $post_id, 'author', true );
    }
    return $override_author_name;
}, 10, 3 );

Generic Example

add_filter(
    'friends_override_author_name',
    function (
        string $string,
        $author_name,
        $post
    ) {
        // Your code here
        return $string;
    },
    10,
    3
);

Parameters

  • string $string
  • $author_name Other examples: $author, $author
  • $post Other examples: get_the_id(), $post

Files

apply_filters( 'friends_override_author_name', '', $author_name, get_the_id() )
apply_filters( 'friends_override_author_name', '', $author_name, get_the_id() )
apply_filters( 'friends_override_author_name', '', $args['author']->display_name, $args['post']->ID )
apply_filters( 'friends_override_author_name', '', $args['author']->display_name, $args['post']->ID )

Hooks

Clone this wiki locally