How to Rewrite Guest Author Name with Custom Fields

Have you ever had a visitor put up for your weblog? How do you cross about giving the writer complete credit score? We have observed many websites the place they upload an writer profile field both above the put up or beneath the put up. But even with the visitor writer field, the writer identify box would nonetheless display the website writer. Some bloggers create complete new writer profiles for his or her visitor authors so as to show the best identify. We suppose that it’s needless to create additional consumer profiles if you recognize that this visitor writer will handiest put up as soon as.

The trick we’re sharing in this text will permit you to display visitor writer’s identify by way of merely getting into a customized box to your put up.

Open your purposes.php report and paste the codes beneath:

    add_filter( 'the_author', 'guest_author_name' );
    add_filter( 'get_the_author_display_name', 'guest_author_name' );

    serve as guest_author_name( $identify ) {
    international $put up;

    $writer = get_post_meta( $post->ID, 'guest-author', true );

    if ( $writer )
    $identify = $writer;

    go back $identify;

Now each time that you’re posting a visitor put up, simply just be sure you upload a customized box known as guest-author and it’s going to substitute the writer’s identify with the textual content that you just installed that customized box.


Recent Articles

The New Apple Music Features to Definitely Try in 2021

Apple Music is a nice app but it is not the most loved app, even among Apple users. The wide range of...

Best Free News Apps for iPhone and iPad in 2021

The year isn’t going as we expected, we are still living through a pandemic and all the problems of the world didn’t...

Best Apps to Hide Pictures & Videos on Your Phone

Privacy is important in everyone’s life, the intensity might change but no one wants to share everything with the world. Even the...

5 Best Health Apps for a Healthy Lifestyle for Everyone in 2021

Times have changed, but the only thing that has remained constant is the need for a healthy lifestyle. Various factors contribute to...

The Most Exciting Features of Apple iOS 14.5 for iPhone and iPad

The Most Exciting Features of Apple iOS 14.5  Apple tries to bring something new and better with every iOS...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here