Hi, @subwebsites,
1. You need to disable the Restriction from Directory Listings > Settings > Extensions > Pricing Plans: https://imgbox.com/LcqOg7YN
2. Currently they do not get removed. If you want them to be removed, you can use this piece of code, just copy-paste this on your functions.php:
add_action( 'directorist_listing_deleted', 'delete_all_attached_media' );
function delete_all_attached_media( $listing_id ) {
if( ! $listing_id || ( get_post_type($listing_id) !== "at_biz_dir" ) ) return;
$gallery_images = get_post_meta($listing_id, '_listing_img', false);
$preview_image = get_post_meta($listing_id, '_listing_prv_img', false);
if(!empty($gallery_images) ) {
if( is_array($gallery_images) && $preview_image ){
array_push($gallery_images, $preview_image);
}
foreach ($gallery_images as $gallery_image) {
wp_delete_attachment( $gallery_image, 'true' );
}
}
if( empty($gallery_image) && !empty($preview_image) ) {
wp_delete_attachment( $preview_image, 'true' );
}
}
Kindly use this with caution as it’ll delete all the attachments of a deleted listing, whether those attachments are used with any other listings or not.
Regards,
Mahdi.
-
This reply was modified 4 years, 2 months ago by
Mahdee.
-
This reply was modified 4 years, 2 months ago by
Mahdee.
-
This reply was modified 4 years, 2 months ago by
Mahdee.
-
This reply was modified 4 years, 2 months ago by
Mahdee.
Thread Starter
Jaso
(@subwebsites)
Thanks, I’ll give it a try