• Hi,

    What happens to expired ads, images, etc.? Will it stay in the database forever?

    We need a function that deletes expired ads after 15 days.

    After a while, a lot of unnecessary images and databases remain junk. This would need to be addressed

    Thanks in advance, Greg

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    the expired ads are not being deleted, right now if you want to have them removed you would need to do it manually from wp-admin panel.

    That being said, deleting an Advert will delete only the Ad the images will not be removed since they are stored as attachments and its possible that some other page is using the image.

    I will most likely add an option to delete the Ad along with the attachments when deleting from wp-admin (there actually should be a code snippet for that somewhere on this forum).

    I am not sure about deleting the expired Ads automatically, for a user that might be an unexpected behavior to have the Ad removed from [adverts_manage] panel.

    Thread Starter zsolt

    (@zsolt82)

    Hi,
    In Hungary, ads are archived for 15 days after their expiration, after which they are deleted.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    ok i did not know that, when i will find some free time, i will prepare a code snippet that will delete the expired Ads automatically.

    Hopefully, it will be ready next week.

    Thread Starter zsolt

    (@zsolt82)

    Hi,

    Thanks in advance

    I am really looking to the setting option of deleting Ad images along with the Ad being deleted. I hope the feature can be added in the next version. Maybe you can check out this plugin im not sure if it will work. https://www.ads-software.com/plugins/dx-delete-attached-media/

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    i am hoping to have the extension which will delete the expired Ads (with attached images) ready this week.

    I will post in this thread when it’s done.

    Thread Starter zsolt

    (@zsolt82)

    Hello

    We wait

    Thanks

    Plugin Author Greg Winiarski

    (@gwin)

    Here you can find the Auto Delete Expired snippet https://github.com/simpliko/wpadverts-snippets/blob/master/auto-delete-expired/auto-delete-expired.php, you can install it the same way as any other snippet https://github.com/simpliko/wpadverts-snippets/.

    By default it will trash the Ads which expired over 15 days ago. To modify the behavior open the wp-config.php file and add there any of the below constants

    
    // delete the ads 30 days after expiration
    define( "AUTO_DELETE_EXPIRED_DELTA", 30 );
    // skip the trash and delete ads permanently
    define( "AUTO_DELETE_EXPIRED_FORCE_DELETE", true );
    // also delete the ad attachments
    define( "AUTO_DELETE_EXPIRED_ATTACHMENTS", true );
    

    The snippet can permanently delete the Ads from your database so use it with caution.

    It’s best to do a full site backup, enable the snippet and check if the correct Ads are being deleted.

    The snippet will be run from WP-CRON once a day.

    Thread Starter zsolt

    (@zsolt82)

    Hi,

    Thank you on behalf of everyone

    If I understand correctly, you will put it in the trash after 15 days?

    this is the code:
    // delete the ads 30 days after expiration
    define( “AUTO_DELETE_EXPIRED_DELTA”, 30 )

    Delete forever?

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    1. yes, by default the Ads will be put to Trash after 15 days.

    2. to delete them forever (after 15 days and skip the trash) use this code in wp-config.php

    
    define( "AUTO_DELETE_EXPIRED_FORCE_DELETE", true );
    
    Thread Starter zsolt

    (@zsolt82)

    hello,

    It works perfectly.

    thanks

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Delete images and expired ads’ is closed to new replies.