Created
October 13, 2019 14:10
-
-
Save IsmailShurrab/ef8b43a0026b05770076f88b8c3df69e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Delete Attachments from Post ID 25 | |
$attachments = get_posts( | |
array( | |
'post_type' => 'attachment', | |
'posts_per_page' => -1, | |
'post_status' => 'any', | |
'post_parent' => 25, | |
) | |
); | |
foreach ( $attachments as $attachment ) { | |
wp_delete_attachment( $attachment->ID ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment