Wednesday, November 16, 2022
HomeWordPress Developmentplugins - Shortcode inside a redirect

plugins – Shortcode inside a redirect


We try to attach the database customers of wordpress and one other web site, me handle to synchronize the login and register utilizing an OpenID Join plugin, however we wish for the person to be redirected to a different url when he isn’t logged in earlier than checkout on woocommerce, so we positioned this code on capabilities:

add_action('template_redirect','check_if_logged_in');
perform check_if_logged_in()
{
    $pageid = get_option( 'woocommerce_checkout_page_id' );
    if(!is_user_logged_in() && is_page($pageid))
    {
    wp_redirect( 'https://anotherwebsite.com' );
    exit(); 
    }
    if(is_user_logged_in())
    {
    if(is_page(get_option( 'woocommerce_myaccount_page_id' )))
    {
        
        $redirect = $_GET['redirect_to'];
        if (isset($redirect)) {
        echo '<script>window.location.href = "'.$redirect.'";</script>';
        }

    }
    }
}

however OpenID Join makes use of a shortcode to generate a dynamic url to despatched to the person to log in or register: [openid_connect_generic_auth_url]. Is there a option to insert the shortcode contained in the wp_redirect( ‘https://anotherwebsite.com’ ); to make it occur?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments