WordPress filter hook
wpf_user_can_access
Fired by 2 WordPress plugins, running on 44K+ sites between them.
“Determine whether a user can access a post.”
How to use wpf_user_can_access
It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'wpf_user_can_access', function( $can_access, $current_user_id, $arg3 ) {
// Change $can_access here.
return $can_access;
}, 10, 3 );Argument names come from Block Visibility's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
2 plugins that fire wpf_user_can_access
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Block Visibility40,000+ installs
apply_filters( 'wpf_user_can_access', $can_access, wpf_get_current_user_id(), false )includes/frontend/visibility-tests/wp-fusion.php:105 -
WP Fusion Lite4,000+ installs
apply_filters( 'wpf_user_can_access', $can_access, $user_id, $post_id )includes/class-access-control.php:304
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.