php code for outputting a custom page in my account

Check this one: How to add a new endpoint in woocommerce Update In your callback function include your extended template page because output is expected. ex: function foren_content() { include(‘woocommerce/myaccount/custom-page.php’); } Then inside custom-page.php call the desired content with get_post(ID) or if you have your endpoint registerd in woocommerce settings call it by slug. The … Read more

Admin only taxonomies?

When registering the taxonomy just set public to false, and it’ won’t be accessible on the front end. Just make sure to specify show_ui to true, otherwise it will use the public value and be hidden. register_taxonomy( ‘my_taxonomy’, ‘product’, [ ‘public’ => false, ‘show_ui’ => true, ] ); If you’re registering the taxonomy with a … Read more

Assign user role by text field in WordPress (Woocommerce) [closed]

Here is the code: function ur_update_role( $valid_form_data, $form_id, $user_id ) { global $table_prefix; $assign_roles_list = array(); if( isset( $valid_form_data[‘billing_ie’]) && !empty( $valid_form_data[‘billing_ie’]->value ) ) { array_push( $assign_roles_list, ‘ie’ ); } if ( ! empty( $assign_roles_list ) ) { // Re-ordering roles according to priority. $user_roles_list = ur_get_default_admin_roles(); foreach ( $user_roles_list as $key => $value ) … Read more