• Resolved w4yp01nt

    (@w4yp01nt)


    Hello,

    I have discovered, that with the way which the plugin-related menu items are written within your plugin in the files ajax.php and my-account.php, they will not link correctly if you are outside of the account area – as in, the /my-account/ url prefix will be missing in the URL.

    In my case, I have a dropdown menu in my header, with all the account menu items – and the “Users” link that this plugin adds to the account menu, will 404 outside of the account area.

    • This topic was modified 8 months, 2 weeks ago by w4yp01nt.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Daniel

    (@sfwc)

    Hi @w4yp01nt,

    Thank you for reaching out!

    If I understand correctly if you hover over the menu item, the …/my-account/… URL part is missing? How were menu items added to the header menu?

    Thread Starter w4yp01nt

    (@w4yp01nt)

    Hi Daniel,

    You understand correctly. Many themes automatically add the account area menu items, as items in a user menu dropdown in the header of the website, for example. This effectively means, that these menu items will be available everywhere on the website quite commonly – but in cases like these, your internal linking breaks.

    I have fixed it myself for now, by rewriting your URLs in my own functions.php file, but I think it would be good practice to account for this yourselves going forward

    It’s quite simple to reproduce. Just print out the account area menu somewhere outside of the /my-account/ url path 👍

    • This reply was modified 8 months, 1 week ago by w4yp01nt.
    • This reply was modified 8 months, 1 week ago by w4yp01nt.
    Plugin Support Daniel

    (@sfwc)

    Hi @w4yp01nt,

    Thank you for the details provided. We tried to reproduce the reported issue with no luck.

    We added the following snippet of code in our theme’s functions.php file (Storefront theme) in order to print the My Account menu items in the header of the site:

    function wc_menu() {

    $endpoints = wc_get_account_menu_items();

    echo '<ul>';

    foreach ( $endpoints as $endpoint_key => $endpoint_name ) {
    $endpoint_url = wc_get_account_endpoint_url( $endpoint_key );
    echo '<li><a href="' . esc_url( $endpoint_url ) . '">' . esc_url( $endpoint_url ) . '</a></li>';
    }

    echo '</ul>';
    }
    add_action( 'wp_body_open', 'wc_menu' );

    But the Subaccounts endpoint URL was printed correctly, even outside of the My Account area as you can see in the image below:

    screenshot-test-local

    What happens if you try to add the above snippet to your site’s functions.php file?

    Plugin Support Daniel

    (@sfwc)

    We haven’t heard from you in a while so I’m going to go ahead and mark this thread as resolved.

    If you have any other questions about the plugin, please start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Small bug report’ is closed to new replies.