2

I have set up an ecommerce site using wordpress/woocommerce and am now adding the users who will be dealing with the orders to the site. The only part of the site that they need to have access to is the woocommerce orders page in the admin side.

Is there a way I can set this as the default area they see on log in? And restrict the rest of the admin side as off limits? I

Thanks in advance for any advice!

1 Answer 1

2

You set a custom url after rewrite from a login.

A small example, usable in a template of the theme to login.

            <?php
            $redirect = esc_url( 'your-url' );
            if ( ! is_user_logged_in() ) {
                $link = '<a href="' . get_option( 'siteurl' ) . '/wp-login.php?redirect_to=' . home_url(
                        '/'
                    ) . '">' . esc_attr__( 'Login', 'documentation' ) . '</a>';
            } else {
                $link = '<a href="' . get_option( 'siteurl' ) . '/' . $redirect . '">' . esc_attr__(
                        'Administration', 'documentation'
                    ) . '</a>';
            }
            echo apply_filters( 'loginout', $link );
            ?>

Also you can use the default hook after login from default login forms, like

// Create new rewrite rule
add_action( 'init', 'fb_rewrite' );
function fb_rewrite() {

    add_rewrite_rule( 'login/?$', 'wp-login.php', 'top' );
}

That should usable in a custom plugin.

2
  • If is helps you or is the right answer, then set the hook on the Answer, this helps other readers to identifier the q/a. thx
    – bueltge
    Jul 2, 2015 at 15:51
  • Thanks - hopefully I have done so now - I'm new to the stack exchange, so apologies!
    – trustfools
    Jul 3, 2015 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.