Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Changing Status when expired

$
0
0

Replies: 1

Open simple-post-expiration.php

Replace Line 84 to end, to this instead:

/**
* Filters the post titles
 *
 * @access public
 * @since 1.0
 * @return void
*/
function pw_spe_filter_title( $title = '', $post_id = 0 ) {

        if( pw_spe_is_expired( $post_id ) ) {

            // Post is expired so attach the prefix
            $prefix = get_option( 'pw_spe_prefix', __( 'Expired:', 'pw-spe' ) );
            $title  = $prefix . ' ' . $title;

            //Change Post post_status
            wp_update_post(array(
                'ID'    =>  $post_id,
                'post_status'   =>  'draft'
            ));

        }

    return $title;

}
add_filter( 'the_title', 'pw_spe_filter_title', 100, 2 );

Changes post to Draft when expired

  • This topic was modified 14 minutes ago by samjco.

Viewing all articles
Browse latest Browse all 59525

Trending Articles