Insert custom postmeta when custom post type published
Newer New solution: function wpse153622_transition_solution( $new_status, $old_status, $post ) { if ( $new_status != $old_status && ‘publish’ === $new_status && ‘my-solution’ === $post->post_type ) { update_post_meta( $post_id, ‘my_json’, ‘json’ ); } } add_action( ‘transition_post_status’, ‘wpse153622_transition_solution’, 10, 3 ); This should trigger only when 1. the new post status isn’t the same as the old one … Read more