Custom post type are very important in wordpress. Code for save metadata in wordpress custom post type. There are some plugins for creating the post type but I recommend custom code in function.php file.
How to save metadata in wordpress custom post type
I already written about custom post type. If you want to know about custom post type in detail then you can use following articles.
- Create custom post type with permalink
- How to add the custom post type with associated tags and category
- How to use the custom post type in wordpress
- Add tags support in custom post type
- File upload with add_meta_box or custom_post_type in wordpress
Here in this tutorial I showed How to save the meta data for your custom post type.
add_action( 'add_meta_boxes', 'job_detail_box' ); function job_detail_box() { add_meta_box( 'job_detail_box', __( 'job Detail', 'myplugin_textdomain' ), 'job_detail_box_content', 'job', 'normal', 'high' ); } function job_detail_box_content( $post ) { // No need to globalise a post that is an argument on this callback $meta_p = get_post_meta($post->ID, "jobs_price", true); $meta_l = get_post_meta($post->ID, "jobs_location", true); echo '<input type="hidden" name="jobs-nonce" id="jobs-nonce" value="' . wp_create_nonce( 'jobs-nonce' ) . '" />'; ?> <div> <ul> <ul> <ul> <li><label>job Price</label>php echo $meta_p; ?>" /></li> </ul> </ul> <ul> <ul> <li><label>job Location</label>php echo $meta_l; ?>" /></li> </ul> </ul> </ul> </div> <!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php } add_action ('save_post', 'save_jobs'); // The save_post hook provides the post id to the return function function save_jobs( $post_id ){ if ( !wp_verify_nonce( $_POST['jobs-nonce'], 'jobs-nonce' )) { return $post_id; } if ( !current_user_can( 'edit_post', $post_id )) return $post_id; update_post_meta($post_id, "jobs_price", $POST['jobs_price'] ); update_post_meta($post_id, "jobs_location", $POST['jobs_location'] ); }