wpsc_post_transition() WPSCache 1.0
No Hooks.
Return
Null. Nothing.
Usage
wpsc_post_transition( $new_status, $old_status, $post );
Code of wpsc_post_transition() wpsc post transition WPSCache 1.7.1
function wpsc_post_transition( $new_status, $old_status, $post ) {
$ptype = is_object( $post ) ? get_post_type_object( $post->post_type ) : null;
if ( empty( $ptype ) || ! $ptype->public ) {
return;
}
if ( $old_status === 'publish' && $new_status !== 'publish' ) { // post unpublished
if ( ! function_exists( 'get_sample_permalink' ) ) {
require_once( ABSPATH . 'wp-admin/includes/post.php' );
}
list( $permalink, $post_name ) = get_sample_permalink( $post );
$post_url = str_replace( array( "%postname%", "%pagename%" ), $post->post_name, $permalink );
}
elseif ( $old_status !== 'publish' && $new_status === 'publish' ) { // post published
wp_cache_post_edit( $post->ID );
return;
}
if ( ! empty( $post_url ) ) {
wp_cache_debug( 'wpsc_post_transition: deleting cache of post: ' . $post_url );
wpsc_delete_url_cache( $post_url );
wpsc_delete_post_archives( $post );
}
}