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 $override_author_name,
        string $author_name,
        int $post_id
    ) {
        // Your code here
        return $override_author_name;
    },
    10,
    3
);

Parameters

  • string $override_author_name The author name to override with.
  • string $author_name The author name.
  • int $post_id The post ID.

Files

Hooks

Clone this wiki locally