front / wp-redisearch

Flexible and fast search engine for Wordpress.
26 stars 5 forks source link

postPrepare function returning empty author names when indexing #14

Open fidoboy opened 3 years ago

fidoboy commented 3 years ago

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);