wpsc_post_transition()
Hooks from the function
Return
null
. Nothing (null).
Usage
wpsc_post_transition( $new_status, $old_status, $post );
- $new_status (required)
- -
- $old_status (required)
- -
- $post (required)
- -
wpsc_post_transition() wpsc post transition code WPSCache 1.12.4
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; } // Allow plugins to reject cache clears for specific posts. if ( ! apply_filters( 'wp_super_cache_clear_post_cache', true, $post ) ) { return; } if ( ( $old_status === 'private' || $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 ); } }