An Author ‘XYZ’ is need to be set as the Default author of all New Posts. Irrespective of the actual Author posting the content, the post should be saved by this author ‘XYZ’.
Is there a Plugin or custom functions, which serves this purpose?
Note : The existing posts should stay as it is, no 'change of author' for old posts, only new one should be effected.
Update:
This hook runs as the post is being published, not after, so the command is trying to overwrite what the system is doing at the same time. So here’s a modified version that cancels all of this is the post was previously published. If you’re wanting it to never allow user’s to update the author, perhaps you could hide that meta field. I’m not aware of a hook that runs immediately after publish of a post, but if there were one, hooking into it would allow solve this problem.
Disclaimer: All this code is not tested, so there may be minor edits needed.