$_GET['topic_ID'], 'post_type' => 'reply', 'orderby' => 'menu_order', 'order' => 'asc', ] ); $forum_topics = ''; if ( is_array( $topics ) ) : foreach ( $topics as $topic ) : $forum_topics .= $topic->ID . ','; endforeach; endif; $topics_id = $topic_id . ',' . $forum_topics; $topic_ids = explode( ',', $topics_id ); $topic_id_int = array_map( 'intval', $topic_ids ); foreach ( $topic_id_int as $delete_topic ) { wp_trash_post( $delete_topic, true ); } wp_safe_redirect(admin_url( 'admin.php?page=bbp-core' )); } } } new Delete_Topic();