When posts are pruned they delete the featured image and any attached media. Can we disable that in the plugin? Sometimes we have common media across several posts and it still deletes, leaving 404s behind.
When posts are pruned they delete the featured image and any attached media. Can we disable that in the plugin? Sometimes we have common media across several posts and it still deletes, leaving 404s behind.
Hi Joe,
the current code will indeed remove the attachments that were uploaded on the current (deleted) post.
Thanks for your suggestion.
If you are in need to this to NOT delete attachments, edit the auto-prune-posts.php like so:
OPEN
auto-prune-posts.php
FIND
if ($atts) {
foreach ($atts as $att) {
// Deletes this attachment
wp_delete_attachment($att->ID, $force_delete);
}
}
REPLACE WITH
if ( false && $atts ) {
foreach ($atts as $att) {
// Deletes this attachment
wp_delete_attachment($att->ID, $force_delete);
}
}
Excellent, thanks!