Check get_the_author()
(Note:This tag must be used within The Loop.)
you code may be like this
In functions.php:
add_action( 'save_post', 'add_authors_name');
function add_authors_name( $post_id ) {
global $post;
$post_author = $post->post_author; // returns the Author ID
// get the author's WP_User object so we can get the Author Name
$post_author_obj = get_userdata( $post_author );
$post_author_name = $post_author_obj->first_name . ' ' . $post_author_obj->last_name;
wp_set_post_terms( $post_id, $post_author_name, 'post_tag', true );
}
Related Posts:
- Remove tag on my RSS Feed
- get_the_excerpt() not returning anything when post has no excerpt
- Adding a class to tag list in a function
- Create single.php for specific tag by tag id or name
- list tags with count in author profile page
- Product Tags in Add New product as checkbox list [closed]
- Retrieve tags data in post body
- Echo tags used to describe the theme
- Frontend tag edit/submit form
- Is possible add icon in title posts only in specific tag?
- Display tags that only appear in one category
- Add a unique class to HTML tag/element
- How to edit the Tags within the image file URLs?
- Function filter breaking tag archive menus
- Tags break custom Excerpt function
- Numbering lines of code with the tag?
- Randomizing wp_tag_cloud() in child theme
- Sort and display pages with specific custom field (not tag)
- Function to echo (or display?) wordpress tags in the head section
- What is wp_get_post_tags for media tags?
- Allow user only create specific tags
- Removing sanitize_title_with_dashes Function with The Real Title
- method to fetch entire tag list on archive.php
- require_once() Causing categories and tag pages on dashboard to not refrsh
- Change post count on tag/terms pages to 10
- Custom taxonomy not refreshing page on add
- Automatically add tag if a checkbox is checked
- getExcerpt: Make ellipsis appear only if character limit is reached
- Make WordPress search for only this tags or exclude certain tags from search [duplicate]
- How to get tags and categories?
- If two tags in the middle i need comma
- Display function from functions.php in tag.php
- Bulk set Post Title as Tag where Tag is Empty Function
- plugins_url vs plugin_dir_url
- Get list of years when posts have been published
- Is it possible to remove the “standard” post format?
- Do WordPress’ cron’s clean up expired transients?
- How to add first name & last name to default registration form?
- Masking logout URL
- Warning/Notice about functions.php
- Is checking whether the blog is installed necessary?
- Should I ask a theme developer to use locate_template rather than require_once
- Customized wp_new_user_notification
- Should everything in functions.php be hooked or filtered?
- How to add an anonymous function in wordpress hooks by removing create_function
- How to update feed only 2-3 times a week (for Feedburner email)?
- Fatal error when trying to get admin email on contact form
- Is it good practice to use wpdb->query() function?
- wp_enqueue_script add integrity parameter
- Passing arguments to my function with do_action and add_action is not working
- List child pages of specific page using shortcode
- Adding HTML to the end of every post with the Block Editor
- Can I hide certain upload folders in media library [duplicate]
- Function issue with Walker_Nav_Menu [duplicate]
- wp_nav_menu, walker class, categories as classes of li
- Calling a Function in Functions.php from an external PHP script
- Including a specific Javascript Script in a template. Is my code correct?
- Custom shortcodes not inserting into visual composer columns
- Adding a colorbutton in tinymce dialog with current api
- Post meta not updating
- append to existing parent theme function
- Get category URL for current post
- How can I get the post id from within functions.php
- Check if Page Slug Exists, then display that Page’s Title
- Why doesn’t is_page(id) work in functions.php?
- I have problems with loading javascripts
- Enqueuing latest version of jQuery into a child theme returns a blank screen
- Function to alphabetically sort custom post types creating duplicates
- Dropline menus — seperators between children only?
- Echoing function into WordPress NextGen gallery
- does wp function the_content(); accept another tag inside
- How to parse a shortcode within a shortcode?
- Variables not showing in short code
- Prevent loading of functions
- Get term slug by term id and then explode it
- Shortcode question
- call_user_func_array() expects parameter 1 to be a valid callback, function
- Custom posts – tag pagination
- the_widget() inside functions.php
- define css class in functions.php
- Adding tables to the WordPress Editor
- Add Login and logout buttons to top menu bar
- implementing a centralized content “show-do-not-show” toggle?
- Load templates, pass arguments, and render output from functions.php
- How to load a css file depending on the current role
- How to add HTML into error message
- Add a word after the post url if it is within a specific category
- Security when outputing wp_oembed_get code
- Function for Sticky Post on Categories causes issues with 404 behavior
- Get value of pre-populated Gravity forms field as variable in my function
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- Graphic before title – Specific Category
- Edit meta fields from within template
- What to do to have access to WordPress functions
- Adding a meta box fields to child theme options page
- Changing the color of post title [closed]
- How to programmatically GET (to know) which Sidebar (or) which Menu is being used on Different Pages?
- WordPress not performing direct update
- Remove theme, change theme button and WP version on “Right Now” admin dashboard?
- How to add more than one menu for logged in members?