{"id":34149,"date":"2010-06-20T16:37:01","date_gmt":"2010-06-20T20:37:01","guid":{"rendered":"http:\/\/wpmu.org\/?p=34149"},"modified":"2012-10-08T23:20:14","modified_gmt":"2012-10-09T03:20:14","slug":"daily-tip-how-to-rewrite-author-name-on-post-for-a-guest-author","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/daily-tip-how-to-rewrite-author-name-on-post-for-a-guest-author\/","title":{"rendered":"How to Rewrite Author Name on Post For a Guest Author"},"content":{"rendered":"<p>Ever want to post an article submitted to your blog by someone else?<\/p>\n<p>Here&#8217;s an easy way to post it yourself as admin and rewrite the author&#8217;s name to whatever you want on a case by case basis.<\/p>\n<p>Add this to your <i>single.php<\/i> and\/or <i>page.php<\/i> file where you want the author name to show up:<\/p>\n<pre>&lt;?php $author = get_post_meta($post-&gt;ID, \"guest-author\", true);\r\nif ($author != \"\") {\r\necho $author;\r\n} else {\r\nthe_author();\r\n} ?&gt;<\/pre>\n<p>Ordinarily, you would just replace this tag with the above code:<\/p>\n<p><code>&lt;?php the_author_url(); ?&gt;<\/code><\/p>\n<p>Now, when you want to add a guest author&#8217;s name to the post, simply create a custom field called guest-author and add the name of the author as the value of the field.<\/p>\n<p style=\"font-size: 12px;\">Source: <a href=\"http:\/\/www.wprecipes.com\/rewrite-author-name-with-custom-field\" rel=\"noopener\" target=\"_blank\">WP Recipes<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever want to post an article submitted to your blog by someone else? Here&#8217;s an easy way to post it yourself as admin and rewrite the author&#8217;s name to whatever you want on a case by case basis. Add this to your single.php and\/or page.php file where you want the author name to show up: [&hellip;]<\/p>\n","protected":false},"author":4099,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[1,557,235,263],"tags":[640],"tutorials_categories":[],"class_list":["post-34149","post","type-post","status-publish","format-standard","hentry","category-news-community","category-development","category-misc","category-tutorials","tag-authors"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/34149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/4099"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=34149"}],"version-history":[{"count":3,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/34149\/revisions"}],"predecessor-version":[{"id":182566,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/34149\/revisions\/182566"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=34149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=34149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=34149"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=34149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}