Set expiration date to WordPress posts imported from CSV file

This short post is for people who need to import many posts to WordPress blog via CSV and set expiration date for them.

These two goals can be achieved separately using multiple plugins however when you need to achieve both of them — that is where issues are found.

Plugins I have tried:

Really Simple CSV Importer — https://wordpress.org/plugins/really-simple-csv-importer/

Post Expirator — https://wordpress.org/plugins/post-expirator/

The first one works well. Posts are imported including all custom fields needed. The second works well also but only when you save the post via Dashboard. However when you include expiration details in CSV nothing happens. The reason for this is the fact that plugin adds cron job for post expiration only during post saving.

Solution:

VA Simple Expires — https://wordpress.org/plugins/va-simple-expires/

This plugin has solved the issue and posts successfully were marked as expired («Ended» section in Dashboard) and were removed from home page at the website. To make it work just add the following columns to CSV:

scadenza-enable — should be 1 for each post
scadenza-date — date/time for expiring  (example: 2016-04-10 00:01:00)

That’s it.

Читайте также: