Tag Info

New answers tagged

0

Without knowing the surrounding code, it is hard to tell what the problem might be, but you said you checked the $post variable. Maybe the $post variable is not set properly, the save_post action only gives you the post id: function get_post_title($post_id) { $post = get_post($post_id); if (empty($post->post_title)) { // No title set, put in ...


1

Whoever wrote your theme didn't bother to verify the existence of array keys before using them. The error is happening because the key album_tracks_metabox_nonce doesn't exist in the $_POST array. The line likely should be: if ( !isset($_POST['album_tracks_metabox_nonce']) || !wp_verify_nonce($_POST['album_tracks_metabox_nonce'], ...


1

As Darshan Thanki hinted (and Stephen Harris further elaborated), you can use pre_post_update to your advantage. global $___new_post; $___new_post = true; add_action( 'pre_post_update', function() { global $___new_post; $___new_post = false; }, 0 ); function is_new_post() { global $___new_post; return $___new_post; } The reason why I ...



Top 50 recent answers are included