Woocommerce: WooCommerce disables WP profile page and redirect filter doesn't work.

Created on 20 Jan 2016  路  3Comments  路  Source: woocommerce/woocommerce

When WooCommerce is installed subscribers can't access the /wp-admin/profile.php page. Could we have an option to disable the WooCommerce "My Account" page entirely so that the profile page can be used? Is there currently any way to enable the default profile page for subscribers?

I tried to work around this by using a redirect filter but can't get it to work.
I have also tested this on a brand new fresh WordPress installation with only WooCommerce installed.

Here's the code I'm trying to use for the redirect:

<?php
/*
Plugin Name: Disable My Account
Description: Disable WooCommerce My Account page.
Version: 0.1
*/

function filter_wc_login_redirect( $redirect, $user ) { 
    // This doesn't work
    $redirect = home_url() . "/wp-admin/profile.php";
    // This works
    $redirect = "http://google.com";

    return $redirect;
}

function filter_wp_login_redirect( $redirect_to, $request, $user ) {
    // This doesn't work
    $redirect = home_url() . "/wp-admin/profile.php";
    // This works
    $redirect = "http://google.com";

    return $redirect;
}

add_filter( 'login_redirect', 'filter_wp_login_redirect', 10, 3 );
add_filter( 'woocommerce_login_redirect', 'filter_wc_login_redirect', 10, 2 );

The google url works, but the default profile page doesn't.
Is this a bug and how can I work around it?

Most helpful comment

Not a bug, just missing it:

add_filter( 'woocommerce_prevent_admin_access', '__return_false' );

All 3 comments

Not a bug, just missing it:

add_filter( 'woocommerce_prevent_admin_access', '__return_false' );

Wow, thanks!

I was bashing my head against the wall for a while on this one.
Good job there's a solution :)

Alright, I've been banging my head against this for awhile and I can't get either of the redirects to work. Everything always redirects to /my-account for some reason no matter how much I try to override it.

It seems like there are many other reports of this in other places too.

(Running a fresh install with twentyfifteen and WC 2.5.2 right now)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikejolley picture mikejolley  路  3Comments

admench picture admench  路  3Comments

svenauhagen picture svenauhagen  路  3Comments

richangel picture richangel  路  3Comments

starypop picture starypop  路  3Comments