Skip invalidation of child post content when editing a parent.

This prevents invalidating caches for topics and replies when editing a forum or a topic. Without this in place, WordPress will attempt to invalidate all child posts whenever a parent post is modified. This can cause thousands of cache invalidations to occur on a single edit, which is no good for anyone.

since 2.1.0 bbPress (r4011)
package bbPress
subpackage Cache

 Methods

Hook into the 'pre_post_update' action.

__construct() 
since 2.1.0 bbPress (r4011)

Only clean post caches for main bbPress posts.

pre_post_update(integer $post_id = 0) : \If

Check that the post being updated is a bbPress post type, saves the post ID to be used later, and adds an action to 'clean_post_cache' that prevents child post caches from being cleared.

since 2.1.0 bbPress (r4011)

Parameters

$post_id

integer

The post ID being updated

Returns

\Ifinvalid post data

Restore the cache invalidation to its previous value.

restore_cache_invalidation() 
since 2.1.0 bbPress (r4011)

 Properties

 

The original value of $_wp_suspend_cache_invalidation global

$original_cache_invalidation : boolean

Default

false
 

Post ID being updated

$updating_post : integer

Default

0