“Halaman toko pengalihan wooCommerce” Kode Jawaban

Halaman toko pengalihan wooCommerce

// Redirect WooCommerce Shop URL
function wpc_shop_url_redirect() {
    if( is_shop() ){
        wp_redirect( home_url( '/custom-page/' ) ); // Assign custom internal page here
        exit();
    }
}
add_action( 'template_redirect', 'wpc_shop_url_redirect' );
Gifted Gharial

Manajer Toko Redirect @ WooCommerce

add_filter( 'login_redirect', 'login_redirect_shop_manager_on_orders_list', 10, 3 );
function login_redirect_shop_manager_on_orders_list( $redirect_to, $request, $user ) {
    $defined_user_role = 'shop_manager'; // The defined user role

    if( isset($user->roles) && is_array($user->roles) && in_array( $defined_user_role, $user->roles ) ) {
        $redirect_to = admin_url('edit.php?post_type=shop_order'); // Custom redirection url

        wp_safe_redirect( $redirect_to ); // Force redirection
        exit(); // Mandatory to avoid errors
    }
    return $redirect_to;
}
Unsightly Unicorn

Jawaban yang mirip dengan “Halaman toko pengalihan wooCommerce”

Pertanyaan yang mirip dengan “Halaman toko pengalihan wooCommerce”

Lebih banyak jawaban terkait untuk “Halaman toko pengalihan wooCommerce” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya