我正成功地在WooCommerce My账户科添加新习惯。 但是,我无法改变菜单项目链接,而是与我的URL账户挂钩。
I want to remove the http://site-test.local/my-account
from this absolute link "http://site-test.local/my-account/https:/mycustomwebsite.com/"
我只想看到“https:/mycustomwebsite.com/”在我点击“NEW CUSTOM TAB”的菜单。
我在我的主题职能中加入了这一法典。 php file:
function custom_add_my_account_menu_item($items) {
// Add a new menu item with the key custom_option
$items[ https://mycustomwebsite.com ] = __( NEW CUSTOM TAB , your-text-domain );
$cleanLink = str_replace( http://site-test.local/my-account , , $items); //I m trying to remove the site-test.local/my-account, but it doesn t work
$items = $cleanLink;
return $items;
}
add_filter( woocommerce_account_menu_items , custom_add_my_account_menu_item );
// Display content for the custom option in the My Account section
function custom_my_account_endpoint_content() {
echo <p>This is the content for the custom option.</p> ;
}
add_action( woocommerce_account_custom_option_endpoint , custom_my_account_endpoint_content );
如何改变菜单项目与习俗的联系?