Question

I have a CPT called "profile" that only supports the editor and thumbnail. Each user is limited to posting just 1 profile.

I'm looking for a way to prefill the title and slug fields with the display name of the post author. As it is now, if I click on Publish, the post_status in the db is "Auto Draft" and the URL becomes "localhost/mytestsite/profile/auto-draft-1". It seems WP needs a title or else it won't be considered "Published".

I've checked several questions already posted here and this one seems like the one I need. Custom Post Type with Custom Title

But since I want the author's name and not values in a taxonomy or custom field, I don't know how to modify the code to reflect that.

I see that get_the_author() needs to be in The Loop.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top