Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Change post author without using wp_update_post()

On the few occasions when I’ve needed to do something similar, I’ve used the callback unattach-update-reattach method, which is also described on this older Q&A, Update post on save and on the developer docs comments.

function your_save_post_callback( $post_id, $post, $update ) {
    // unattach the callback
    remove_action('save_post', 'your_save_post_callback');

    // update post
    wp_update_post( $args );

    // reattach the callback
    add_action('save_post', 'your_save_post_callback');
}

Related Posts:

  1. Better post meta efficiency?
  2. Get Meta Key Value While Saving Post
  3. Change all author links in Blog roll
  4. Update post meta within save_post action
  5. How to hide meta from search result only on pages?
  6. How to check if post meta key exists or not in wordpress database
  7. How to add category to: ‘wp-admin/post-new.php’?
  8. Hook that get’s triggered when the author of a post is changed
  9. the_author() returns empty string
  10. Prevent Authors from viewing each others Posts
  11. How can I retrieve multiple get_post_meta values efficiently?
  12. Code to make a post sticky
  13. Display Random Author with Details in Sidebar
  14. How to allow hidden custom fields to be added from wp-admin/post.php?
  15. Export WordPress Posts and Meta Information in CSV format
  16. How to show list of posts by author and category?
  17. WordPress: How to get the current logged in author page URL?
  18. Delete duplicated wp_postmeta record
  19. How to add editor’s name to entry meta byline?
  20. Different permalink for posts and authors
  21. Will a large postmeta table slow a site down?
  22. Update all posts automatically when using post_meta
  23. What to use: wp_is_post_autosave( $post_id ) or DOING_AUTOSAVE?
  24. How to display posts by current user/author in a custom page template?
  25. How to batch update post content with custom post meta value
  26. Query posts distinct authors
  27. Change slug with custom field
  28. Restrict the Number of Posts an Author can Publish (over time)?
  29. Search posts by post author name
  30. Get the user type of an author
  31. Show the title of the latest post by author
  32. Setting post meta data to random value during post status transition / on publish
  33. Find most recent authors
  34. Show author post count in sidebar – Variable
  35. How can I pass $post object to ‘save_post’ add_action?
  36. Edit meta data does’t work with custom sql
  37. Get current users post URL?
  38. Get the author of the latest revision
  39. Filter posts by author and category simultaneously
  40. Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects
  41. Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
  42. Human Time Diff, change mins to minutes
  43. Post author is changed to admin after his post is modified by admin
  44. Change post format using custom field
  45. Have save_post write to database image meta [closed]
  46. Get the post_id of a new post
  47. Get all posts by post_author
  48. Does WP get all post_meta on POST page?
  49. Sanitizing `wp_editor();` Values for Database, Edit, and Display
  50. Exporting Data from WordPress into a flat table
  51. Adding Multiple Values to a Post Meta Key
  52. How can I control multiple editing of wordpress posts?
  53. Using radio button meta data from a custom meta box
  54. Multiple authors for single post without plugin
  55. Limit number of posts a user can make per minute?
  56. Authors in menu, template list post by author
  57. Show the author’s count of total amount of posts assign to a custom taxonomy term
  58. Author must complete profile info before they can publish a post?
  59. WP rest api returns 404 only when author param is used
  60. publish_post conflicts with save_post
  61. How can I list random authors from current post category?
  62. PHP Notice error (when on 404 page)
  63. What Is meta_id In wp_postmeta?
  64. Checking if a post with certain meta value exists
  65. How to permanently delete a post meta entry?
  66. Add custom field automatically (add_post_meta) with value based on number of words of article
  67. How to generate numbers indistinguishable for the IDs of the posts
  68. Modify WP_Post before processing
  69. Save re-arranged draggable post items to wordpress database
  70. I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
  71. Change post_date to post_modified date on post template?
  72. How can I show wordpress posts based on author?
  73. Show info to author only
  74. Auto “expire” all of an authors posts on spcific date
  75. Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
  76. How to get the user meta data for a post?
  77. Limit posts per author role (excluding admin) in home page
  78. Guest Author – How to display posts on /author/ archive page
  79. How to get post bulk edit action trigger and get edited post ids?
  80. How can I show many posts an author has per week?
  81. How to give capability (publish contributors posts) to author role?
  82. How can I sort posts by the date and a custom meta field?
  83. is there a way to show the the post title after the image?
  84. Whitelist Author of Private Post
  85. Show posts by a custom post author
  86. Force the “Choose from the most used tags” meta box section to always be expanded
  87. Meta value does not save for scheduled posts
  88. Custom Posts Query and meta_query Sort Order
  89. Updating post data on save (save_post vs wp_insert_post_data)
  90. Getting the current author (it has changed) of a post, not the original author
  91. How to compare two posts including their meta fields on a scalable base?
  92. Getting value from get_post_custom
  93. Calling Different Custom Post Timestamps in a table
  94. Is it possible to paste a link without tags and make it directly a link in a post?
  95. Showing author page if user has no post
  96. Cannot retrieve a custom RSS field from posts
  97. Saving custom fields to a custom taxonomy
  98. Display Notification Bar on Header on Certain Post Count
  99. How to automate featured posts number? [duplicate]
  100. How do I retrieve a users’ last 5 posts?
Categories posts Tags author, post-meta, posts, save-post
What plugins create a directory on the root directory of WordPress? [closed]
Best way to include reusable sections in page content

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress