Filters the final yes/no decision produced by the PRO version’s Block Visibility feature. PRO lets editors attach visibility rules to any block (user role, post type, ACF field value, etc.); when WordPress renders the block, those rules are evaluated server-side and the result is passed through this filter. Returning false always hides the block; returning true always shows it. Use this to add custom visibility logic on top of the rule editor — IP-based gating, A/B-test groups, time-of-day windows, integration with external services, etc.
Parameters
apply_filters( 'afb/should_render_block', $should_render, $rules, $block );Code language: PHP (php)
$should_render(bool) — The result of evaluating the rule editor (true= visible,false= hidden).$rules(array) — The visibility rules attached to the block.$block(array) — The block’s full attributes.
Example
// Hide every block during a maintenance window, regardless of its own rules.
add_filter( 'afb/should_render_block', function( $should_render ) {
$now = current_time( 'timestamp' );
$from = strtotime( '2026-06-01 02:00:00' );
$to = strtotime( '2026-06-01 04:00:00' );
if ( $now >= $from && $now <= $to ) {
return false;
}
return $should_render;
} );Code language: PHP (php)