Skip to content

postPrepare function returning empty author names when indexing  #14

@fidoboy

Description

@fidoboy

Right now the function postPrepare in Index.php is making this, and it’s not working fine for me:

$user = get_userdata( $post->post_author ); if ( $user instanceof WP_User ) { $user_data = $user->display_name; } else { $user_data = ''; }

But it can be more simple and less expensive this way;

$user_data = get_the_author_meta(“display_name”, $post->post_author);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions