Пользовательская страница регистрации моей учетной записи (с именем edit-password):
Код: Выделить всё
add_filter ( 'woocommerce_account_menu_items', 'silva_log_history_link', 40 );
function silva_log_history_link( $menu_links ){
$menu_links = array_slice( $menu_links, 0, 5, true )
+ array( 'edit-password' => 'Edit Password' )
+ array_slice( $menu_links, 5, NULL, true );
return $menu_links;
}
add_action( 'init', 'silva_add_endpoint' );
function silva_add_endpoint() {
// WP_Rewrite is my Achilles' heel, so please do not ask me for detailed explanation
add_rewrite_endpoint( 'edit-password', EP_PAGES );
}
add_action( 'woocommerce_account_edit-password_endpoint', 'silva_my_account_endpoint_content' );
function silva_my_account_endpoint_content() {
#some code for separation
}
Код: Выделить всё
function custom_wc_add_notice( $message ){
if( is_wc_endpoint_url( 'edit-account' ) ){
global $woocommerce;
extract( $_POST );
$message .= ' Your custom message';
}
return $message;
}
add_filter( 'woocommerce_add_notice', 'custom_wc_add_notice', 10, 1 );
add_filter( 'woocommerce_add_error', 'custom_wc_add_notice', 10, 1 );
add_filter( 'woocommerce_add_success', 'custom_wc_add_notice', 10, 1 );
Подробнее здесь: https://stackoverflow.com/questions/781 ... point-page