Wordpress login page redirecting to Woocommerce My-Account Page for Normal Users Wordpress login page redirecting to Woocommerce My-Account Page for Normal Users wordpress wordpress

Wordpress login page redirecting to Woocommerce My-Account Page for Normal Users


I spent a lot of time looking for the answer to this one and it can be found in the class-wc-admin.php file under the prevent_admin_access function.

Add the following code:

add_filter( 'woocommerce_prevent_admin_access', '__return_false' );

To your functions PHP file and it will stop it blocking users who do not have: 'edit_posts', 'manage_woocommerce', 'view_admin_dashboard' from accessing the dashboard.

For good measure you can also add this which overrides the account permalink to be your admin page - which may be relevant.

function my_account_permalink($permalink) {    return admin_url();}add_filter( 'woocommerce_get_myaccount_page_permalink', 'my_account_permalink', 1); 


As LauraTheExplorer said, use this filter:

add_filter( 'woocommerce_prevent_admin_access', '__return_false' );

Use this filter to also enable the Admin Bar:

add_filter('woocommerce_disable_admin_bar', '__return_false');


There might be another plugin redirecting a user to the WooCommerce, My Account Page.

In the case of the Formidable Forms plug in along with the Formidable Registration plug in, this can happen if the Login/Logout Page is set to the My Account Page. This setting can be found at Formidable, Global Settings, Registration and under Global Pages change the Login/Logout - click the drop list and scroll to the blank line at the top of this list.

However in your case you might have a different plug in doing something similar.