Skip to main content

benecaster_supporter_wall_enabled

Action Free

Two per-show transition actions fire when the Supporter Wall is toggled on or off for a show: benecaster_supporter_wall_enabled fires when the wall is turned on (a 01 transition) and benecaster_supporter_wall_disabled fires when it is turned off (10). Same-value writes — for example, an admin saving the show editor without changing the wall toggle — do not fire either action.

Because these are transition-gated, they are well-suited for cache invalidation: they fire at most once per actual state change, so full-page caches containing the [benecaster_supporter_wall] shortcode can be flushed precisely without over-flushing on every show save.

Parameters

Name Type Default Description
$show_id int ID of the show

Examples

Flush page cache when wall is toggled

function bc_flush_supporter_wall_pages( int $show_id ): void {
    if ( function_exists( 'rocket_clean_post' ) ) {
        $show_page_id = get_post_meta( $show_id, '_benecaster_show_wall_page_id', true );
        if ( $show_page_id ) {
            rocket_clean_post( (int) $show_page_id );
        }
    }
}

add_action( 'benecaster_supporter_wall_enabled',  'bc_flush_supporter_wall_pages' );
add_action( 'benecaster_supporter_wall_disabled', 'bc_flush_supporter_wall_pages' );

Need this built rather than just documented? See our services →