• Resolved El Pablo

    (@el-pablo)


    I’m setting up a website for subscriptions. A user who subscribes, can pick a free account or a paid account. Accordingly, his his user role will change into ‘Free account’ or ‘Premium account. I have set up this user roles with the Members plugin (https://prnt.sc/zmv8e8).

    I now want to give these user roles access to the WP backend, because they must be able to add posts to a certain content type (https://prnt.sc/zmvndt). Nonetheless I notice that when they are logged in and they go to /wp-admin, they are redirected to the my account page.

    How can I prevent this redirect from happening? Is this a WooCommerce filter, or does this have to do with my user role permissions?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    or you can do like this

    function ahir_my_account_permalink($permalink) {
    
        return admin_url();
    }
    
    add_filter( 'woocommerce_get_myaccount_page_permalink', 'ahir_my_account_permalink', 1); 
    Thread Starter El Pablo

    (@el-pablo)

    @hemant-ahir thank you very much, that’s what I needed.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect to my account page’ is closed to new replies.