Plugin Directory

Changeset 2084130


Ignore:
Timestamp:
05/09/2019 01:30:42 AM (7 years ago)
Author:
ivankk
Message:

Preparing for 1.3 release

Location:
expiring-posts/trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • expiring-posts/trunk/expiring-posts.php

    r2054375 r2084130  
    11<?php
    2 
    32/*
    43Plugin Name: Expiring Posts
     
    65Description: Allows a post to move to a new status for expired posts on a specified date.
    76Author: Tanner Moushey, Ivan Kruchkoff, 10up
    8 Version: 1.2
     7Version: 1.3
    98Author URI: http://www.10up.com
    109
     
    2827
    2928
    30 define( 'EXPIRING_POSTS_URL' , plugins_url( '/', __FILE__ ) );
     29define( 'EXPIRING_POSTS_URL', plugins_url( '/', __FILE__ ) );
    3130
    3231class EXP_Expiring_Posts {
     
    4544     */
    4645    public static function instance() {
    47         if ( is_null( self::$instance ) )
     46        if ( is_null( self::$instance ) ) {
    4847            self::$instance = new self();
     48        }
    4949
    5050        return self::$instance;
     
    7272
    7373        // Save expired posts meta
    74         add_action( 'save_post', array( $this, 'save_expiration_date' ) );
    75 
    76         // Update all posts view to show expired status
    77         add_action( 'display_post_states' , array( $this, 'add_expiry_post_states' ) );
    78 
    79     }
    80 
    81     /**
    82     * Display expired/expiring status in All Posts view
    83     *
    84     * @param $states
    85     */
    86     function add_expiry_post_states( $states ) {
    87         global $post;
    88 
    89         $is_expired = get_post_status( $post->ID ) === "expired";
    90         $is_expiring = get_post_meta( $post->ID, 'exp_pending_expiration', true );
    91         $expiry_time = implode( get_post_meta( $post->ID, 'exp_expiration_date' ) );
    92         // Check if expired or pending expiry
    93         // Post can have an expiry time, but not be expired (if they check the never box)
    94         if ( $is_expired || ( $is_expiring && strlen( $expiry_time ) ) ) {
    95             $expiry_message = $is_expired ? "Expired" : "Expiring: $expiry_time";
    96             $states[] = __( '<span class="expiry">' . $expiry_message . '</span>' );
    97         }
    98 
    99         return $states;
    100     }
     74        add_action( 'save_post', array( $this, 'save_expiration_date' ) );
     75
     76        // Update all posts view to show expired status
     77        add_action( 'display_post_states', array( $this, 'add_expiry_post_states' ) );
     78
     79    }
     80
     81    /**
     82    * Display expired/expiring status in All Posts view
     83    *
     84    * @param $states
     85    */
     86    function add_expiry_post_states( $states ) {
     87        global $post;
     88
     89        $is_expired  = get_post_status( $post->ID ) === 'expired';
     90        $is_expiring = get_post_meta( $post->ID, 'exp_pending_expiration', true );
     91        $expiry_time = implode( get_post_meta( $post->ID, 'exp_expiration_date' ) );
     92        // Check if expired or pending expiry
     93        // Post can have an expiry time, but not be expired (if they check the never box)
     94        if ( $is_expired || ( $is_expiring && strlen( $expiry_time ) ) ) {
     95            $expiry_message = $is_expired ? 'Expired' : "Expiring: $expiry_time";
     96            $states[]      = __( '<span class="expiry">' . $expiry_message . '</span>' );
     97        }
     98
     99        return $states;
     100    }
    101101
    102102    /**
     
    119119
    120120        // Check its not an auto save
    121         if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
    122             return;
     121        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
     122            return;
     123        }
    123124
    124125        // make suer we have all of our values
    125         if ( !isset($_POST['expiring_posts_nonce']) || !isset($_POST['exp-aa']) || !isset($_POST['exp-mm']) || !isset($_POST['exp-jj']) || !isset($_POST['exp-hh']) || !isset($_POST['exp-mn']) || !isset($_POST['exp-ss']) )
    126             return;
     126        if ( ! isset( $_POST['expiring_posts_nonce'] ) || ! isset( $_POST['exp-aa'] ) || ! isset( $_POST['exp-mm'] ) || ! isset( $_POST['exp-jj'] ) || ! isset( $_POST['exp-hh'] ) || ! isset( $_POST['exp-mn'] ) || ! isset( $_POST['exp-ss'] ) ) {
     127            return;
     128        }
    127129
    128130        // Check permissions
    129         if ( !current_user_can( 'edit_post', $post_id ) )
    130             return;
     131        if ( ! current_user_can( 'edit_post', $post_id ) ) {
     132            return;
     133        }
    131134
    132135        // Finally check the nonce
     
    134137
    135138        $prev_expiration_date = get_post_meta( $post_id, 'exp_expiration_date', true );
    136         $post_status = get_post_status( $post_id );
     139        $post_status          = get_post_status( $post_id );
    137140
    138141        // if post was manually set to expired, we want to record the current time with expired_post_transition()
    139         if ( 'expired' == $post_status && ( ! $prev_expiration_date || strtotime( $prev_expiration_date ) >= time() ) )
    140             return;
    141 
    142         $aa = $_POST['exp-aa'];
    143         $mm = $_POST['exp-mm'];
    144         $jj = $_POST['exp-jj'];
    145         $hh = $_POST['exp-hh'];
    146         $mn = $_POST['exp-mn'];
    147         $ss = $_POST['exp-ss'];
    148         $jj = ($jj > 31 ) ? 31 : $jj;
    149         $hh = ($hh > 23 ) ? $hh -24 : $hh;
    150         $mn = ($mn > 59 ) ? $mn -60 : $mn;
    151         $ss = ($ss > 59 ) ? $ss -60 : $ss;
     142        if ( 'expired' == $post_status && ( ! $prev_expiration_date || strtotime( $prev_expiration_date ) >= time() ) ) {
     143            return;
     144        }
     145
     146        $aa              = $_POST['exp-aa'];
     147        $mm              = $_POST['exp-mm'];
     148        $jj              = $_POST['exp-jj'];
     149        $hh              = $_POST['exp-hh'];
     150        $mn              = $_POST['exp-mn'];
     151        $ss              = $_POST['exp-ss'];
     152        $jj              = ( $jj > 31 ) ? 31 : $jj;
     153        $hh              = ( $hh > 23 ) ? $hh - 24 : $hh;
     154        $mn              = ( $mn > 59 ) ? $mn - 60 : $mn;
     155        $ss              = ( $ss > 59 ) ? $ss - 60 : $ss;
    152156        $expiration_date = "$aa-$mm-$jj $hh:$mn:$ss";
    153         $valid_date = wp_checkdate( $mm, $jj, $aa, $expiration_date );
    154 
    155         if ( ! $valid_date )
    156             return;
     157        $valid_date      = wp_checkdate( $mm, $jj, $aa, $expiration_date );
     158
     159        if ( ! $valid_date ) {
     160            return;
     161        }
    157162
    158163        update_post_meta( $post_id, 'exp_expiration_date', sanitize_text_field( $expiration_date ) );
     
    160165        // Enabling the expiration feature is opt-in, where the checkbox is
    161166        // checked by default
    162 
    163167        // If post is already expired, make sure the this is visually represented
    164168        if ( 'expired' == $post_status ) {
     
    167171            // post is scheduled to expire, enable expiration and set hook. Exception is if the post has
    168172            // just transitioned from expired to publish
    169         } elseif ( !isset( $_POST['exp-enable'] ) && !( 'expired' === $_POST['hidden_post_status'] && 'publish' === $post_status ) ) {
     173        } elseif ( ! isset( $_POST['exp-enable'] ) && ! ( 'expired' === $_POST['hidden_post_status'] && 'publish' === $post_status ) ) {
    170174            $this->schedule_post_expiration( $post_id );
    171175
     
    181185     */
    182186    function admin_scripts( $page ) {
    183         if ( 'post.php' != $page && 'post-new.php' != $page )
    184             return;
     187        if ( 'post.php' != $page && 'post-new.php' != $page ) {
     188            return;
     189        }
    185190
    186191        global $post;
     
    197202        wp_enqueue_script( 'admin-expiring-posts', EXPIRING_POSTS_URL . '/inc/js/expiring-posts.js', array( 'jquery' ) );
    198203
    199         wp_localize_script( 'admin-expiring-posts', 'AdminExpiringPosts', array(
    200             'expires_on' => __( 'Expires on:' ),
    201             'expires_never' => __( 'Expires: <b>never</b>' ),
    202             'expired_text' => __( 'Expired' ),
    203             'save_text' => __( 'Save Post' ),
    204             'post_status' => get_post_status(),
    205         ) );
     204        wp_localize_script(
     205            'admin-expiring-posts',
     206            'AdminExpiringPosts',
     207            array(
     208                'expires_on'    => __( 'Expires on:' ),
     209                'expires_never' => __( 'Expires: <b>never</b>' ),
     210                'expired_text'  => __( 'Expired' ),
     211                'save_text'     => __( 'Save Post' ),
     212                'post_status'   => get_post_status(),
     213            )
     214        );
    206215
    207216        wp_enqueue_style( 'expiring-posts-css', EXPIRING_POSTS_URL . '/inc/css/expiring-posts.css' );
     
    224233        }
    225234
    226         if ( 0 == $post->ID )
    227             return;
    228 
    229         $post_type = $post->post_type;
    230         $post_type_object = get_post_type_object($post_type);
    231         $can_publish = current_user_can($post_type_object->cap->publish_posts);
    232         $expiration_date = strtotime( get_post_meta( $post->ID, 'exp_expiration_date', true ) );
     235        if ( 0 == $post->ID ) {
     236            return;
     237        }
     238
     239        $post_type          = $post->post_type;
     240        $post_type_object   = get_post_type_object( $post_type );
     241        $can_publish        = current_user_can( $post_type_object->cap->publish_posts );
     242        $expiration_date    = strtotime( get_post_meta( $post->ID, 'exp_expiration_date', true ) );
    233243        $expiration_enabled = get_post_meta( $post->ID, 'exp_pending_expiration', true );
    234244
    235245        // set default expiration date if one is not present.
    236246        // strtotime returns false if the string is not a valid time
    237         if ( ! $expiration_date )
     247        if ( ! $expiration_date ) {
    238248            $expiration_date = time() + ( DAY_IN_SECONDS * 5 ); // add 5 days to current time
     249        }
    239250
    240251        $datef = __( 'M j, Y @ G:i' );
     
    251262        // added an expired status that is appended to the post status editor with js
    252263        if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
    253             <select style="display:none;"><option <?php selected( $post->post_status, 'expired' ); ?> id='expired-status' value='expired'><?php _e( 'Expired' ) ?></option></select>
     264            <select style="display:none;"><option <?php selected( $post->post_status, 'expired' ); ?> id='expired-status' value='expired'><?php _e( 'Expired' ); ?></option></select>
    254265            <div class="misc-pub-section curtime">
    255266                <span id="exp-timestamp" style="background-image: url(<?php echo admin_url(); ?>images/date-button.gif);"><?php printf( $stamp, $date ); ?></span>
    256                 <a href="#" class="exp-edit-timestamp hide-if-no-js"><?php _e( 'Edit' ) ?></a>
     267                <a href="#" class="exp-edit-timestamp hide-if-no-js"><?php _e( 'Edit' ); ?></a>
    257268                <div id="exp-timestampdiv" class="hide-if-js"><?php $this->select_time( $post->ID ); ?></div>
    258269            </div>
     
    274285
    275286        $tab_index_attribute = '';
    276         if ( (int) $tab_index > 0 )
     287        if ( (int) $tab_index > 0 ) {
    277288            $tab_index_attribute = sprintf( ' tabindex="%s"', intval( $tab_index ) );
     289        }
    278290
    279291        $expiration_date = strtotime( get_post_meta( $post_id, 'exp_expiration_date', true ) );
    280292
    281293        // strtotime returns false if a valid string is not provided
    282         if ( ! $expiration_date )
     294        if ( ! $expiration_date ) {
    283295            $expiration_date = time() + ( DAY_IN_SECONDS * 5 ); // add 5 days to current time
     296        }
    284297
    285298        // define date format
     
    295308        $ss = mysql2date( 's', $expiration_date, false );
    296309
    297         $month = "<select " . ( $multi ? '' : 'id="exp-mm" ' ) . "name=\"exp-mm\"$tab_index_attribute>\n";
    298         for ( $i = 1; $i < 13; $i = $i +1 ) {
    299             $monthnum = zeroise($i, 2);
    300             $month .= "\t\t\t" . '<option value="' . $monthnum . '"';
    301             if ( $i == $mm )
     310        $month = '<select ' . ( $multi ? '' : 'id="exp-mm" ' ) . "name=\"exp-mm\"$tab_index_attribute>\n";
     311        for ( $i = 1; $i < 13; $i = $i + 1 ) {
     312            $monthnum = zeroise( $i, 2 );
     313            $month   .= "\t\t\t" . '<option value="' . $monthnum . '"';
     314            if ( $i == $mm ) {
    302315                $month .= ' selected="selected"';
     316            }
    303317            /* translators: 1: month number (01, 02, etc.), 2: month abbreviation */
    304318            $month .= '>' . sprintf( __( '%1$s-%2$s' ), $monthnum, $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) ) . "</option>\n";
     
    306320        $month .= '</select>';
    307321
    308         $day = '<input type="text" ' . ( $multi ? '' : 'id="exp-jj" ' ) . 'name="exp-jj" value="' . esc_attr( $jj ) . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
    309         $year = '<input type="text" ' . ( $multi ? '' : 'id="exp-aa" ' ) . 'name="exp-aa" value="' . esc_attr( $aa ) . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" />';
    310         $hour = '<input type="text" ' . ( $multi ? '' : 'id="exp-hh" ' ) . 'name="exp-hh" value="' . esc_attr( $hh ) . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
     322        $day    = '<input type="text" ' . ( $multi ? '' : 'id="exp-jj" ' ) . 'name="exp-jj" value="' . esc_attr( $jj ) . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
     323        $year   = '<input type="text" ' . ( $multi ? '' : 'id="exp-aa" ' ) . 'name="exp-aa" value="' . esc_attr( $aa ) . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" />';
     324        $hour   = '<input type="text" ' . ( $multi ? '' : 'id="exp-hh" ' ) . 'name="exp-hh" value="' . esc_attr( $hh ) . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
    311325        $minute = '<input type="text" ' . ( $multi ? '' : 'id="exp-mn" ' ) . 'name="exp-mn" value="' . esc_attr( $mn ) . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
    312326
    313327        echo '<div class="exp-timestamp-wrap">';
    314328        /* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */
    315         printf(__('%1$s%2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute);
     329        printf( __( '%1$s%2$s, %3$s @ %4$s : %5$s' ), $month, $day, $year, $hour, $minute );
    316330
    317331        echo '</div><input type="hidden" id="exp-ss" name="exp-ss" value="' . $ss . '" />';
    318332
    319         if ( $multi ) return;
     333        if ( $multi ) { return;
     334        }
    320335
    321336        echo "\n\n";
    322         foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) {
     337        foreach ( array( 'mm', 'jj', 'aa', 'hh', 'mn' ) as $timeunit ) {
    323338            echo '<input type="hidden" id="hidden_exp-' . $timeunit . '" name="hidden_exp-' . $timeunit . '" value="' . esc_attr( $$timeunit ) . '" />' . "\n";
    324339        }
    325340        ?>
    326341
    327         <input type="checkbox" name="exp-enable" <?php checked( get_post_meta( $post_id, 'exp_pending_expiration', true ) == false ) ?> id="exp-enable" value="never" />
     342        <input type="checkbox" name="exp-enable" <?php checked( get_post_meta( $post_id, 'exp_pending_expiration', true ) == false ); ?> id="exp-enable" value="never" />
    328343        <label for="exp-enable"><?php _e( 'Never expire' ); ?></label>
    329344
     
    332347            <a href="#exp-edit_timestamp" class="exp-cancel-timestamp hide-if-no-js"><?php _e( 'Cancel' ); ?></a>
    333348        </p>
    334     <?php
     349        <?php
    335350    }
    336351
     
    338353     * Register custom status for expired posts
    339354     */
    340     function expiring_post_status(){
    341         $args =  array(
     355    function expiring_post_status() {
     356        $args = array(
    342357            'label'                     => _x( 'Expired', 'post' ),
    343358            'public'                    => false,
     
    363378        $expiration_date = get_post_meta( $post_id, 'exp_expiration_date', true );
    364379
    365         if ( strtotime( $expiration_date ) && strtotime( $expiration_date ) < time() )
    366             return;
    367 
    368         $datef = __( 'Y-m-d H:i:s' );
     380        if ( strtotime( $expiration_date ) && strtotime( $expiration_date ) < time() ) {
     381            return;
     382        }
     383
     384        $datef           = __( 'Y-m-d H:i:s' );
    369385        $expiration_date = date_i18n( $datef, time() );
    370386        update_post_meta( $post_id, 'exp_expiration_date', sanitize_text_field( $expiration_date ) );
     
    380396        global $wpdb;
    381397
    382         if ( ! $post = get_post( $post ) )
    383             return;
     398        if ( ! $post = get_post( $post ) ) {
     399            return;
     400        }
    384401
    385402        $wpdb->update( $wpdb->posts, array( 'post_status' => 'expired' ), array( 'ID' => $post->ID ) );
     
    387404        clean_post_cache( $post->ID );
    388405
    389         $old_status = $post->post_status;
     406        $old_status        = $post->post_status;
    390407        $post->post_status = 'expired';
    391408        wp_transition_post_status( 'expired', $old_status, $post );
     
    406423    function schedule_post_expiration( $post ) {
    407424
    408         if ( ! $post = get_post( $post ) )
     425        if ( ! $post = get_post( $post ) ) {
    409426            return new WP_Error( 'exp_expiring_posts_error', __( 'This is not a valid post.' ) );
     427        }
    410428
    411429        update_post_meta( $post->ID, 'exp_pending_expiration', true );
    412430
    413         if ( 'expired' === get_post_status( $post->ID ) )
     431        if ( 'expired' === get_post_status( $post->ID ) ) {
    414432            return true;
     433        }
    415434
    416435        // Verify that post is set to expire
    417         if ( ! $expiring_time = strtotime( get_post_meta( $post->ID, 'exp_expiration_date', true ) ) )
     436        if ( ! $expiring_time = strtotime( get_post_meta( $post->ID, 'exp_expiration_date', true ) ) ) {
    418437            return new WP_Error( 'exp_expiring_posts_error', __( 'This post cannot be expired, the expiration date is invalid.' ) );
     438        }
    419439
    420440        $this->reset_expiration_event();
     
    431451    function unschedule_expired_post( $post ) {
    432452
    433         if ( ! $post = get_post( $post ) )
     453        if ( ! $post = get_post( $post ) ) {
    434454            return new WP_Error( 'exp_expiring_posts_error', __( 'The post provided is not a valid post.' ) );
     455        }
    435456
    436457        delete_post_meta( $post->ID, 'exp_pending_expiration' );
     
    450471
    451472        // something went wrong, bail early
    452         if ( ! is_array( $times ) || empty( $times ) )
    453             return;
     473        if ( ! is_array( $times ) || empty( $times ) ) {
     474            return;
     475        }
    454476
    455477        sort( $times, SORT_NUMERIC );
    456478
    457         $next_time = reset( $times );
    458         $next_scheduled = wp_next_scheduled( 'exp_expire_post_event');
     479        $next_time      = reset( $times );
     480        $next_scheduled = wp_next_scheduled( 'exp_expire_post_event' );
    459481
    460482        // if the schedule is already correct, exit
    461         if ( $next_scheduled && $next_scheduled === $next_time )
    462             return;
    463         elseif( $next_scheduled )
     483        if ( $next_scheduled && $next_scheduled === $next_time ) {
     484            return;
     485        } elseif ( $next_scheduled ) {
    464486            wp_unschedule_event( $next_scheduled, 'exp_expire_post_event' );
     487        }
    465488
    466489        wp_schedule_single_event( $next_time, 'exp_expire_post_event' );
     
    478501        $curr_time = time();
    479502
    480         $next_scheduled = wp_next_scheduled( 'exp_expire_post_event');
     503        $next_scheduled = wp_next_scheduled( 'exp_expire_post_event' );
    481504
    482505        // make sure this is the right time to run, if not reset the time for the
    483506        // next scheduled event
    484         if ( $next_scheduled > $curr_time )
     507        if ( $next_scheduled > $curr_time ) {
    485508            return $this->reset_expiration_event();
     509        }
    486510
    487511        $times = $this->get_expiring_posts();
    488512
    489513        // something went wrong, bail early
    490         if ( ! is_array( $times ) || empty( $times ) )
    491             return;
    492 
    493         foreach( $times as $post_id => $time ) {
    494 
    495             if ( $time <= $curr_time )
     514        if ( ! is_array( $times ) || empty( $times ) ) {
     515            return;
     516        }
     517
     518        foreach ( $times as $post_id => $time ) {
     519
     520            if ( $time <= $curr_time ) {
    496521                $this->expire_post( $post_id );
    497 
     522            }
    498523        }
    499524
     
    525550        $post_ids = $wpdb->get_col( $querystr );
    526551
    527         if ( ! is_array( $post_ids ) )
     552        if ( ! is_array( $post_ids ) ) {
    528553            return false;
     554        }
    529555
    530556        foreach ( $post_ids as $post_id ) {
     
    540566            }
    541567            $gmtime = get_gmt_from_date( get_post_meta( $post_id, 'exp_expiration_date', true ) );
    542             if ( $expiration_date = strtotime( $gmtime ) )
    543                 $expiring_posts[$post_id] = $expiration_date;
     568            if ( $expiration_date = strtotime( $gmtime ) ) {
     569                $expiring_posts[ $post_id ] = $expiration_date;
     570            }
    544571        }
    545572
     
    563590function exp_expire_post( $post, $expiration_date = false ) {
    564591
    565     if ( ! $expiration_date )
     592    if ( ! $expiration_date ) {
    566593        $expiration_date = time();
    567 
    568     if ( ! is_int( $expiration_date ) )
     594    }
     595
     596    if ( ! is_int( $expiration_date ) ) {
    569597        $expiration_date = strtotime( $expiration_date );
    570 
    571     if ( ! ( $post = get_post( $post ) ) || $expiration_date === false )
     598    }
     599
     600    if ( ! ( $post = get_post( $post ) ) || $expiration_date === false ) {
    572601        return new WP_Error( 'exp_expiring_posts_error', __( 'Either the post or expiration date provided are not valid.' ) );
    573 
    574     $datef = __( 'Y-m-d H:i:s' );
     602    }
     603
     604    $datef            = __( 'Y-m-d H:i:s' );
    575605    $expiration_datef = date_i18n( $datef, $expiration_date );
    576606
     
    582612    $expiring_posts = EXP_Expiring_Posts::instance();
    583613
    584     if ( $expiration_date <= time() )
     614    if ( $expiration_date <= time() ) {
    585615        $expiring_posts->expire_post( $post );
     616    }
    586617
    587618    $expiring_posts->schedule_post_expiration( $post );
     
    600631function exp_unschedule_expiring_post( $post ) {
    601632
    602     if ( ! $post = get_post( $post ) )
     633    if ( ! $post = get_post( $post ) ) {
    603634        return new WP_Error( 'exp_expiring_posts_error', __( 'The post provided is not valid.' ) );
     635    }
    604636
    605637    $expiring_posts = EXP_Expiring_Posts::instance();
  • expiring-posts/trunk/readme.txt

    r2054375 r2084130  
    11=== Expiring Posts ===
    22Contributors: ivankk
    3 Tags: post-expiry, expiring-posts, expire
     3Tags: post-expiry, expiring-posts, expire, expiring, expire-posts
    44Requires at least: 3.0.1
    5 Tested up to: 5.1
     5Tested up to: 5.2
    66Requires PHP: 5.3
    7 Stable tag: 1.2
     7Stable tag: 1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    10  
     10
     11== Description ==
     12
    1113This plugin adds functionality to expire a post on a given date.
    1214
     15This plugin currently only works with the classical editor.
     16
    1317It does this by adding a new "Expires" date field in the Publish box.
     18
     19By default posts don't expire, but you can add a date instead.
     20
     21Once that date is reached, the post is marked as expired and is no longer visible to the end user.
     22
     23== Dev Notes ==
     24* Dev occurs via https://github.com/ivankruchkoff/wp-expiring-posts
     25* the new post status is `expired`
     26* a filter called `exp_disable_expiration_for_this_post` exists to disable this feature on a per-post basis.
     27
     28== FAQ ==
     29= If I enable this plugin, what will happen to my existing posts? =
     30Nothing, the posts current post state will remain unchanged.
     31
     32= Will I be able to see expired posts? =
     33Yes, they will be visible in the _expired_ view within the post entry list for your post type.
     34
     35= Will this plugin work with custom post types too? =
     36Yes.
     37
     38= If I have a post set to expire and I use the filter to disable expiry for a speicific post, what happens? =
     39When the `exp_disable_expiration_for_this_post` filter is used, the UI for control post expiry will not be shown, and the post will not expire. In other words, the filter overrides post expiration.
     40
     41== Screenshots ==
     42
     431. By default a post never expires.
     442. But you can add a date instead.
Note: See TracChangeset for help on using the changeset viewer.