Help with merging filters
-
So I have previousy used all this code to help bypass necessary functions for a members only WooCommerce shop. Now I get php noticed to change v_forcelogin_whitelist to v_forcelogin_bypass – but I’m already using that name. How can I merge the two functions below into one, or minimize everything? The resetpass bypass needs to take into account dynamic URLs…
Thanks ??
/** * Filter Force Login to allow exceptions for specific URLs. * * @param array $whitelist An array of URLs. Must be absolute. * @return array */ function my_forcelogin_whitelist( $whitelist ) { $whitelist[] = home_url( '/login/' ); $whitelist[] = home_url( '/logout/' ); $whitelist[] = home_url( '/register/' ); $whitelist[] = home_url( '/lostpassword/' ); return $whitelist; } add_filter( 'v_forcelogin_whitelist', 'my_forcelogin_whitelist' ); /** * Bypass Force Login to allow for exceptions. * * @param bool $bypass Whether to disable Force Login. Default false. * @return bool */ function my_forcelogin_bypass( $bypass ) { if ( is_page('resetpass') ) { $bypass = true; } return $bypass; } add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass' );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Help with merging filters’ is closed to new replies.