Modifying Title Before Saving Custom Post
-
I’m trying to find an efficient way to modify both the title and slug of custom post type. I would like to systematically generate a title based on a custom meta data value and the post id. Both the title would be something like {metadata-value}-{post-id}. For this custom post type, I don’t want my user to be able to set the title so I’ve disabled it on the ‘Edit Post’ screen.
Modifying the title dynamically seems to be very tricky and searching for help has yielded few results. My first instinct was to hook into the save_post action, but I don’t know how to set the title once I’m there. I’d prefer not to create a custom meta data field like ‘custom-title’, I’d like to modify the actual title prior to saving if possible.
Any ideas?
- The topic ‘Modifying Title Before Saving Custom Post’ is closed to new replies.