Changeset 2084130
- Timestamp:
- 05/09/2019 01:30:42 AM (7 years ago)
- Location:
- expiring-posts/trunk
- Files:
-
- 2 added
- 2 edited
-
expiring-posts.php (modified) (30 diffs)
-
readme.txt (modified) (1 diff)
-
screenshot-1.jpg (added)
-
screenshot-2.jpg (added)
Legend:
- Unmodified
- Added
- Removed
-
expiring-posts/trunk/expiring-posts.php
r2054375 r2084130 1 1 <?php 2 3 2 /* 4 3 Plugin Name: Expiring Posts … … 6 5 Description: Allows a post to move to a new status for expired posts on a specified date. 7 6 Author: Tanner Moushey, Ivan Kruchkoff, 10up 8 Version: 1. 27 Version: 1.3 9 8 Author URI: http://www.10up.com 10 9 … … 28 27 29 28 30 define( 'EXPIRING_POSTS_URL' , plugins_url( '/', __FILE__ ) );29 define( 'EXPIRING_POSTS_URL', plugins_url( '/', __FILE__ ) ); 31 30 32 31 class EXP_Expiring_Posts { … … 45 44 */ 46 45 public static function instance() { 47 if ( is_null( self::$instance ) ) 46 if ( is_null( self::$instance ) ) { 48 47 self::$instance = new self(); 48 } 49 49 50 50 return self::$instance; … … 72 72 73 73 // Save expired posts meta 74 add_action( 'save_post', array( $this, 'save_expiration_date' ) );75 76 // Update all posts view to show expired status77 add_action( 'display_post_states', array( $this, 'add_expiry_post_states' ) );78 79 }80 81 /**82 * Display expired/expiring status in All Posts view83 *84 * @param $states85 */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 expiry93 // 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 } 101 101 102 102 /** … … 119 119 120 120 // 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 } 123 124 124 125 // 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 } 127 129 128 130 // 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 } 131 134 132 135 // Finally check the nonce … … 134 137 135 138 $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 ); 137 140 138 141 // 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; 152 156 $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 } 157 162 158 163 update_post_meta( $post_id, 'exp_expiration_date', sanitize_text_field( $expiration_date ) ); … … 160 165 // Enabling the expiration feature is opt-in, where the checkbox is 161 166 // checked by default 162 163 167 // If post is already expired, make sure the this is visually represented 164 168 if ( 'expired' == $post_status ) { … … 167 171 // post is scheduled to expire, enable expiration and set hook. Exception is if the post has 168 172 // 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 ) ) { 170 174 $this->schedule_post_expiration( $post_id ); 171 175 … … 181 185 */ 182 186 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 } 185 190 186 191 global $post; … … 197 202 wp_enqueue_script( 'admin-expiring-posts', EXPIRING_POSTS_URL . '/inc/js/expiring-posts.js', array( 'jquery' ) ); 198 203 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 ); 206 215 207 216 wp_enqueue_style( 'expiring-posts-css', EXPIRING_POSTS_URL . '/inc/css/expiring-posts.css' ); … … 224 233 } 225 234 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 ) ); 233 243 $expiration_enabled = get_post_meta( $post->ID, 'exp_pending_expiration', true ); 234 244 235 245 // set default expiration date if one is not present. 236 246 // strtotime returns false if the string is not a valid time 237 if ( ! $expiration_date ) 247 if ( ! $expiration_date ) { 238 248 $expiration_date = time() + ( DAY_IN_SECONDS * 5 ); // add 5 days to current time 249 } 239 250 240 251 $datef = __( 'M j, Y @ G:i' ); … … 251 262 // added an expired status that is appended to the post status editor with js 252 263 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> 254 265 <div class="misc-pub-section curtime"> 255 266 <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> 257 268 <div id="exp-timestampdiv" class="hide-if-js"><?php $this->select_time( $post->ID ); ?></div> 258 269 </div> … … 274 285 275 286 $tab_index_attribute = ''; 276 if ( (int) $tab_index > 0 ) 287 if ( (int) $tab_index > 0 ) { 277 288 $tab_index_attribute = sprintf( ' tabindex="%s"', intval( $tab_index ) ); 289 } 278 290 279 291 $expiration_date = strtotime( get_post_meta( $post_id, 'exp_expiration_date', true ) ); 280 292 281 293 // strtotime returns false if a valid string is not provided 282 if ( ! $expiration_date ) 294 if ( ! $expiration_date ) { 283 295 $expiration_date = time() + ( DAY_IN_SECONDS * 5 ); // add 5 days to current time 296 } 284 297 285 298 // define date format … … 295 308 $ss = mysql2date( 's', $expiration_date, false ); 296 309 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 ) { 302 315 $month .= ' selected="selected"'; 316 } 303 317 /* translators: 1: month number (01, 02, etc.), 2: month abbreviation */ 304 318 $month .= '>' . sprintf( __( '%1$s-%2$s' ), $monthnum, $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) ) . "</option>\n"; … … 306 320 $month .= '</select>'; 307 321 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" />'; 311 325 $minute = '<input type="text" ' . ( $multi ? '' : 'id="exp-mn" ' ) . 'name="exp-mn" value="' . esc_attr( $mn ) . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />'; 312 326 313 327 echo '<div class="exp-timestamp-wrap">'; 314 328 /* 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 ); 316 330 317 331 echo '</div><input type="hidden" id="exp-ss" name="exp-ss" value="' . $ss . '" />'; 318 332 319 if ( $multi ) return; 333 if ( $multi ) { return; 334 } 320 335 321 336 echo "\n\n"; 322 foreach ( array( 'mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) {337 foreach ( array( 'mm', 'jj', 'aa', 'hh', 'mn' ) as $timeunit ) { 323 338 echo '<input type="hidden" id="hidden_exp-' . $timeunit . '" name="hidden_exp-' . $timeunit . '" value="' . esc_attr( $$timeunit ) . '" />' . "\n"; 324 339 } 325 340 ?> 326 341 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" /> 328 343 <label for="exp-enable"><?php _e( 'Never expire' ); ?></label> 329 344 … … 332 347 <a href="#exp-edit_timestamp" class="exp-cancel-timestamp hide-if-no-js"><?php _e( 'Cancel' ); ?></a> 333 348 </p> 334 <?php349 <?php 335 350 } 336 351 … … 338 353 * Register custom status for expired posts 339 354 */ 340 function expiring_post_status() {341 $args = array(355 function expiring_post_status() { 356 $args = array( 342 357 'label' => _x( 'Expired', 'post' ), 343 358 'public' => false, … … 363 378 $expiration_date = get_post_meta( $post_id, 'exp_expiration_date', true ); 364 379 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' ); 369 385 $expiration_date = date_i18n( $datef, time() ); 370 386 update_post_meta( $post_id, 'exp_expiration_date', sanitize_text_field( $expiration_date ) ); … … 380 396 global $wpdb; 381 397 382 if ( ! $post = get_post( $post ) ) 383 return; 398 if ( ! $post = get_post( $post ) ) { 399 return; 400 } 384 401 385 402 $wpdb->update( $wpdb->posts, array( 'post_status' => 'expired' ), array( 'ID' => $post->ID ) ); … … 387 404 clean_post_cache( $post->ID ); 388 405 389 $old_status = $post->post_status;406 $old_status = $post->post_status; 390 407 $post->post_status = 'expired'; 391 408 wp_transition_post_status( 'expired', $old_status, $post ); … … 406 423 function schedule_post_expiration( $post ) { 407 424 408 if ( ! $post = get_post( $post ) ) 425 if ( ! $post = get_post( $post ) ) { 409 426 return new WP_Error( 'exp_expiring_posts_error', __( 'This is not a valid post.' ) ); 427 } 410 428 411 429 update_post_meta( $post->ID, 'exp_pending_expiration', true ); 412 430 413 if ( 'expired' === get_post_status( $post->ID ) ) 431 if ( 'expired' === get_post_status( $post->ID ) ) { 414 432 return true; 433 } 415 434 416 435 // 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 ) ) ) { 418 437 return new WP_Error( 'exp_expiring_posts_error', __( 'This post cannot be expired, the expiration date is invalid.' ) ); 438 } 419 439 420 440 $this->reset_expiration_event(); … … 431 451 function unschedule_expired_post( $post ) { 432 452 433 if ( ! $post = get_post( $post ) ) 453 if ( ! $post = get_post( $post ) ) { 434 454 return new WP_Error( 'exp_expiring_posts_error', __( 'The post provided is not a valid post.' ) ); 455 } 435 456 436 457 delete_post_meta( $post->ID, 'exp_pending_expiration' ); … … 450 471 451 472 // something went wrong, bail early 452 if ( ! is_array( $times ) || empty( $times ) ) 453 return; 473 if ( ! is_array( $times ) || empty( $times ) ) { 474 return; 475 } 454 476 455 477 sort( $times, SORT_NUMERIC ); 456 478 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' ); 459 481 460 482 // 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 ) { 464 486 wp_unschedule_event( $next_scheduled, 'exp_expire_post_event' ); 487 } 465 488 466 489 wp_schedule_single_event( $next_time, 'exp_expire_post_event' ); … … 478 501 $curr_time = time(); 479 502 480 $next_scheduled = wp_next_scheduled( 'exp_expire_post_event' );503 $next_scheduled = wp_next_scheduled( 'exp_expire_post_event' ); 481 504 482 505 // make sure this is the right time to run, if not reset the time for the 483 506 // next scheduled event 484 if ( $next_scheduled > $curr_time ) 507 if ( $next_scheduled > $curr_time ) { 485 508 return $this->reset_expiration_event(); 509 } 486 510 487 511 $times = $this->get_expiring_posts(); 488 512 489 513 // 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 ) { 496 521 $this->expire_post( $post_id ); 497 522 } 498 523 } 499 524 … … 525 550 $post_ids = $wpdb->get_col( $querystr ); 526 551 527 if ( ! is_array( $post_ids ) ) 552 if ( ! is_array( $post_ids ) ) { 528 553 return false; 554 } 529 555 530 556 foreach ( $post_ids as $post_id ) { … … 540 566 } 541 567 $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 } 544 571 } 545 572 … … 563 590 function exp_expire_post( $post, $expiration_date = false ) { 564 591 565 if ( ! $expiration_date ) 592 if ( ! $expiration_date ) { 566 593 $expiration_date = time(); 567 568 if ( ! is_int( $expiration_date ) ) 594 } 595 596 if ( ! is_int( $expiration_date ) ) { 569 597 $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 ) { 572 601 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' ); 575 605 $expiration_datef = date_i18n( $datef, $expiration_date ); 576 606 … … 582 612 $expiring_posts = EXP_Expiring_Posts::instance(); 583 613 584 if ( $expiration_date <= time() ) 614 if ( $expiration_date <= time() ) { 585 615 $expiring_posts->expire_post( $post ); 616 } 586 617 587 618 $expiring_posts->schedule_post_expiration( $post ); … … 600 631 function exp_unschedule_expiring_post( $post ) { 601 632 602 if ( ! $post = get_post( $post ) ) 633 if ( ! $post = get_post( $post ) ) { 603 634 return new WP_Error( 'exp_expiring_posts_error', __( 'The post provided is not valid.' ) ); 635 } 604 636 605 637 $expiring_posts = EXP_Expiring_Posts::instance(); -
expiring-posts/trunk/readme.txt
r2054375 r2084130 1 1 === Expiring Posts === 2 2 Contributors: ivankk 3 Tags: post-expiry, expiring-posts, expire 3 Tags: post-expiry, expiring-posts, expire, expiring, expire-posts 4 4 Requires at least: 3.0.1 5 Tested up to: 5. 15 Tested up to: 5.2 6 6 Requires PHP: 5.3 7 Stable tag: 1. 27 Stable tag: 1.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 == Description == 12 11 13 This plugin adds functionality to expire a post on a given date. 12 14 15 This plugin currently only works with the classical editor. 16 13 17 It does this by adding a new "Expires" date field in the Publish box. 18 19 By default posts don't expire, but you can add a date instead. 20 21 Once 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? = 30 Nothing, the posts current post state will remain unchanged. 31 32 = Will I be able to see expired posts? = 33 Yes, 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? = 36 Yes. 37 38 = If I have a post set to expire and I use the filter to disable expiry for a speicific post, what happens? = 39 When 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 43 1. By default a post never expires. 44 2. But you can add a date instead.
Note: See TracChangeset
for help on using the changeset viewer.