So Im just getting started with Custom Post Types. I’m trying to make a custom post called a Certificate. The thing is, I don’t need any of the usual ‘editor’ boxes or anything that would normally be in a post. All I need is an upload form for a user to upload a file.
So I’ve set up the the Certificate post-type, and I made it so it doesn’t support anything, so nothing appears on the page. I then added a ‘admin_init’ hook to display a form.
But now i’m a little stuck. Can someone give me a breif outline of what hooks to use to process the form? How do I make it so it activates this hook only for ‘Certificate’ post types?
Take a look at this answer.
You can use the
save_post hook. Your hooked-in function examines the posted data and runs a block of code only if the
$_POST['post_type'] matches your Certificate type.
The function should also ensure that the user has the authentication and intention of running the particular function.
More information including a full worked example of adding a post meta box and processing the data is included in the WordPress codex at: http://codex.wordpress.org/Function_Reference/add_meta_box