• Resolved LesTexas60

    (@lestexas60)


    I see the Pro version is suppose to have a Post Expiration option. Can an expiration date be set per post? We have event posts that should auto delete based on a specific date. Is this possible in Free r Pro?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @lestexas60,

    Thank you for ticket.

    I am afraid, in the free version of WPUF, you will be unable to set expiration date on the post form and the post will not get expiration as well.

    By default it will be unavailable to auto-delete the posts after a certain period using the free version of WPUF. You can customize such a way so that the posts get auto delete after some time.

    Here is an example code for you to help you with the process:

    /**
     * Add monthly interval to the schedules (since WP doesnt provide it from the start)
     */
    
    add_filter('cron_schedules','cron_add_monthly');
    function cron_add_monthly($schedules) {
    $schedules['monthly'] = array(
      'interval' => 2419200,
      'display' => __( 'Once per month' )
    );
    return $schedules;
    }
    
    /**
     * Add the scheduling if it doesnt already exist
     */
    add_action('wp','setup_schedule');
    function setup_schedule() {
      if (!wp_next_scheduled('monthly_pruning') ) {
        wp_schedule_event( time(), 'monthly', 'monthly_pruning');
      }
    }
    
    /**
     * Add the function that takes care of removing all rows with post_type=post that are older than 30 days
     */
    add_action( 'monthly_pruning', 'remove_old_posts' );
    function remove_old_posts() {
      global $wpdb;
      $wpdb->query($wpdb->prepare("DELETE FROM wp_posts WHERE post_type='event' AND post_date < DATE_SUB(NOW(), INTERVAL 30 DAY);"));
    }
    

    Please make sure you add the necessary changes for example post type or interval time as you need.

    regards,

    Thread Starter LesTexas60

    (@lestexas60)

    I am considering purchasing the Pro version but I wanted to find out. Can I set a date , Per Post, for a deletion date with Pro? I don’t want a generic deletion time frame like after 30 days. I need each post to have it’s own deletion date. Does Pro provide this? Thank you for your help.

    Hello @lestexas60,

    On the forum, we are unable to discuss anything that is unavailable in the free version of WPUF.

    Please contact the plugin author from their site for any feature that is unavailable in the free version.

    regards,

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Post Expiration option’ is closed to new replies.