Tag Info

New answers tagged

0

Ok, after a little playtime, here is the answer: add_action('save_post', 'ocp_jobs_save_details'); function ocp_jobs_save_details(){ global $post; $genref = sanitize_title( dechex( time() ) ); if ( $post->post_type == 'job' ) { if ( $_POST['ocp_jobs_ref'] ) { $jobs_args = array( 'ID' => $post->ID, 'post_name' => strtolower( ...


0

The trouble is that save_post fires in lots of places other than the "edit post" screen - when it does, your code will think the checkbox is unchecked and overwrite your saved state. Add an additional hidden input to your meta box: <?php // Don't global post, use the $post parameter already passed to the function // global $post; // Avoid undefined ...


0

Of course your custom posts can't be trashed. They can't even get set to private or draft or anything else then publish because your callback change_content() always sets the post status to publish every time a post (of your custom post type) gets saved. However trashing a post just means setting its status to trash. I'm not sure what you want to achieve ...


1

Since WordPress version 3.7. - IIRC - the save_post hook has a third parameter $update: @param     int               $post_ID     Post ID. @param     WP_Post     $post          ...



Top 50 recent answers are included