You appear to be a bot. Output may be restricted
Description
Deletes all posts from the database.
Usage
_delete_all_posts();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/includes/functions.php
Lines:
1 to 16 of 16
function _delete_all_posts() { global $wpdb; $all_posts = $wpdb->get_results( "SELECT ID, post_type from {$wpdb->posts}", ARRAY_A ); if ( ! $all_posts ) { return; } foreach ( $all_posts as $data ) { if ( 'attachment' === $data['post_type'] ) { wp_delete_attachment( $data['ID'], true ); } else { wp_delete_post( $data['ID'], true ); } } }