In WordPress possiamo associare un'azione specifica alla modifica di un custom post type.
La soluzione รจ la seguente:
function my_update_cpt( $post_id ) {
$post_type = get_post_type( $post_id );
if( $post_type == 'mycustompost' ) {
$status = get_post_status( $post_id );
if( $status == 'publish' ) {
// Azione
}
}
}
add_action( 'save_post', 'my_update_cpt' );