Contenuto
add_action( 'gform_delete_entry', 'delete_entry_post_id' ); function delete_entry_post_id ( $entry_id ) { $posts = get_posts(array( 'numberposts' => -1, 'post_type' => 'any', 'meta_query' => array( array( 'key' => 'entry_id', 'value' => $entry_id, 'compare' => '=', ) ), )); if( $posts ): foreach( $posts as $post ): setup_postdata( $post ); wp_delete_post($post->ID); endforeach; wp_reset_postdata(); endif; }