简体   繁体   中英

How to move WooCommerce my-account inside wp-admin?

I am trying to move "my-account" page into wp-admin.

Here is my source code :

add_action( 'admin_menu', 'create_etrade_admin_menu' );

function create_etrade_admin_menu() {
    add_menu_page( 'My Auctions', 'Auctions', 'manage_options', 'etrade-auction-admin-page.php', 'etrade_auction_admin_page', 'dashicons-email', 6  );
}

function etrade_auction_admin_page(){
    ?>
    <div class="wrap">
        <h1>Auctions and Bids</h1>

       <?php echo do_shortcode('[woocommerce_my_account]'); ?>

    </div>
    <?php
}

Unfortunately it's not working.

My question is: Is it possible to use " do_shortcode() " inside function for wp-admin area?

Or is there any other option to do this?

Preliminary remarks:

  • Customer user role is not allowed to go in admin area.
  • My account is a frontend page. It's based on woocommerce templates that are only used for front end purpose and made for it.
  • 'manage_options' capability is only for Administrator user role (used in create_etrade_admin_menu() function).

Shortcodes for backend?

  • Shortcodes are used normally for front end purposes, but not for backend. However you can call the associated functions in backend (but mostly will not work).

My account page on Back end?

You will need to build your project from scratch, may be using some code of WooCommerce templates

Building a backend page:

1. A backend menu access with add_menu_page() function.
2. The submenu calling your page with add_submenu_page() function (optional) .
3. The page is build with a function which name will be called back by add_menu_page() (and add_submenu_page() )…

Reference:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM