I need to require login to /design-editor/
Here is my code:
/**
* fix custom login, remove redirects
*/
function my_login_page( $login_url) {
return site_url( '/my-account/');
}
add_filter( 'login_url', 'my_login_page', 10, 2 );
/**
* Bypass Force Login to allow for exceptions.
*
* @param bool $bypass Whether to disable Force Login. Default false.
* @return bool
*/
function my_forcelogin_bypass( $bypass ) {
// Allow all WooCommerce pages and endpoints
if ( class_exists( 'WooCommerce' ) ) {
if ( is_woocommerce() || is_wc_endpoint_url() ) {
$bypass = true;
}
}
// page
if ( is_page( array( 'home', 'terms-privacy', 'affiliate-disclosure', 'blog' ) ) ) {
$bypass = true;
}
// blogpost
if ( is_single() ) {
$bypass = true;
}
return $bypass;
}
add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass' );
-
This reply was modified 3 years, 4 months ago by airadev1129.