Have you noted that you are verifing that the post type is a page and that user can edit pages and posts?
if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_page', $post_id ) )
return;
} else {
if ( !current_user_can( 'edit_post', $post_id ) )
return;
}
It should be:
if ( 'ranch' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_post', $post_id ) )
return;
} else {
if ( !current_user_can( 'edit_post', $post_id ) )
return;
}
Note: by default standard post capabilities are assigned to custom post types. If you have changed this, you must adjust current_user_can( 'edit_post', $post_id )
width correct capability.
Plus, you may want to fill the meta box input with previous value:
function ranch_location_meta_content( $post ) {
$previous_value = get_post_meta( $post->ID, 'ranch_location', true );
wp_nonce_field( plugin_basename( __FILE__ ), 'ranch_location_meta_content_nonce' );
echo '<label for="ranch_location"></label>';
echo '<input value="'.$previous_value.'" type="text" id="ranch_location" name="ranch_location" placeholder="Enter Ranch Location Here" />';
}