Welcome!
You need to include 'wp-admin/includes/user.php'
before calling wp_delete_user
function. The reason is, it is an admin functionality and it is not available everywhere in code.
In Your case, just put the following line of code at the very beginning of the function.
require_once ABSPATH . 'wp-admin/includes/user.php';
Related Posts:
- Problem with Woocommerce REST API Authentication
- using woocommerce_template_single_add_to_cart in shop-loop – javascript issues [closed]
- Woocommerce hook run after an Order been created through REST API
- Woocommerce api: create product with images – bad request
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- WooCommerce REST API AJAX Auth – 401 response
- Looping through and combining calls to Woocommerce REST API
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- How to add product in woocommerce with php code [closed]
- How to correctly add Javascript in functions.php
- How to check if a plugin (WooCommerce) is active?
- How to trigger WooCommerce order complete email?
- How to check if woocommerce is activated in theme
- How to get Woocommerce order product info
- cURL 28 error after switch from to brew php 7.2 on localhost
- Woocommerce get selected shipping zone id for the current user
- Edit tag cloud widget number
- How to add date range in woocommerce with code
- How to automatically apply woocommerce product title to all product images alt tags?
- Remove Woocommerce product link
- Query WooCommerce orders grouped by several order statuses
- Creating custom Woocommerce attribute taxonomies from a plugin
- get product attributes for current product and store it in a variable
- How to loop through JSON data in wordpress WP REST API
- Creating a post with the REST API, curl and oauth returning 401 error
- Display sorting options dropdown when using WooCommerce product category shortcode
- retrieve thumbnail from post ID of best selling product in category
- Display a selected custom product option in WooCommerce cart
- Does the REST API (official) support custom post types?
- How to have a custom display for both woocommerce archive and product-category pages? [closed]
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- How to make an meta_query optional?
- How to get the original price of the product in woocommerce?
- Woocommerce auto cancel On-Hold after X days
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- WP_Query | Help me create a search term with an ‘OR’ relation?
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- Using Cookie Data For WP_Query Loop
- Create a new user using WP REST API and declare meta object
- WooCommerce – Customer Order History Pagination
- How to get Woocommerce Variation ID? [closed]
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- Automatically check the option “Enable stock management at product level” on product creation
- The values of custom fields are not available functions.php
- How to show order data by multiple ID?
- Use wc_enqueue_js only on specific pages – nested add_action
- How to Remove a Filter from the Admin List Table?
- Ajax call to my WordPress website from an external application [duplicate]
- Woocommerce: How to override core functions in functions.php?
- How Do I Add User Custom Field to REST API Response?
- Woocommerce, recognize the loop of related products
- wordpress custom endpoint multiple params
- register_rest_route regex option for base64 or alternate
- Replace existing content from specific WooCommerce admin orders list column
- Remove commas from WooCommerce checkout addresses fields
- Add product tag names to WooCommerce new order email subject
- WooCommerce Link to Product Category
- Remove General Tab and Plugin Tab in Settings in Woocommerce
- Get WooCommerce shipping methods programmatically
- WooCommerce – Display variation custom field value [closed]
- How to display product cropped thumbnail (150×150) for WooCommerce product categories
- Add a custom text field to WooCommerce admin product data “Variations”
- Add to checkout total lines an additional line below shipping in WooCommerce
- Woocommerce – How to get products which have a sale between 20% to 40%? [closed]
- Translating add to cart woocommerce button [closed]
- Output a WooCommerce product custom field in WooCommerce using get_post_meta()
- Append a term to WooCommerce product existing product category terms
- Woocommerce: Is it possible to overide the settings for allowing to purchase out of stock products [closed]
- Woocommerce HTML email option unavailable
- Continue execution after WP REST API response
- How to add SVG icon above product tab title
- How does WooCommerce ensure that a product doesn’t run out of stock during payment? [closed]
- How To Change The Html of Products filtration sidebar in Woocommerce?
- Display related products with custom output
- How To add custom radio boxes to WooCommerce Billing page and change total price by this field?
- WooCommerce: update custom fields after checkout validation failure
- Add attribute / custom attribute to product in woocommerce
- Trigger Woocommerce New User Email
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- How to generate HMAC-SHA1 signature to use with WP REST API and OAuth1
- Woocommerce filter cart and category specific quantity [closed]
- Use is_product_category() properly
- How to change / delete product short description in Woocommerce
- How to trash multiple post/product programmatically
- Writing scripts using WordPress / WooCommerce classes?
- My Own layout in WooCommerce pages [closed]
- How to get woocommerce cart content without an action?
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- Woocommerce – remove product from category
- How to make custom total price reactive in navigation
- Inject PHP code into “sidebar-content” – code before my WooCommerce sidebar widget?
- How do I fetch all comments per post via WP REST API?
- OrderItem get_total() returns lower value than $order_item->get_product()->get_price() * quantity
- Change description on specific WooCommerce product status change
- Add the Name of Products Ordered to Admin New Order Email WooCommerce
- Changing Woocommerce flat rate every nth number of items
- How to prevent those PHP variables from being cached on WordPress?
- Woocommerce product download URL
- How to select WooCommerce products by post_meta and order them