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 Best Pinterest Alternatives to Use if You are Bored of Pinterest

Pinterest is a loved social media network among the lover of aesthetics, mostly females tbh. Now, however more and more people are...

Ways you can add links to your Instagram post in 2021

Instagram has many cool features which need no introduction. However, there are a number of features that...

Finance App You should Have on Your iPhone and Android

We live in the age of digitization. When everything is digital, it is no surprise that money has joined the club too....

5 Video Editing Softwares to Try Your Hand at in 2021

Video is the king when it comes to social media. With reels dominating Instagram and Facebook and...

Charge Your Laptop Without a Charger in 5 Ways

Forgetting your laptop charger is a pretty common thing. We all have been there and all of...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here