Create guest author page via php


I am building a website that has many guest authors, but there is only one admin account that publishes it all.

Instead of creating multiple accounts, which would be impractical due to the high number of authors, I added a custom field called guest-author to every post and I managed to displayed it dinamically in the frontend.

Later, to change the author in the WordPress panel to show the guest author’s name, I added this to my functions.php:

add_filter( 'the_author', 'guest_author_name' );
add_filter( 'get_the_author_display_name', 'guest_author_name' );
function guest_author_name( $name ) {
    global $post;
    $author = get_post_meta( $post->ID, 'guest-author', true );
    if ( $author )
    $name = $author;
    return $name;

But the problem is that there is not an individual page for each of the guest authors. Is there a way to create via php an author page for each guest author, automatically?

Thanks a lot!

usina 2 months 2022-10-10T13:39:14-05:00 0 Answers 0 views 0

Leave an answer