I simply used the wrong hook for my function.
I replaced:
add_action( 'school_order_completed', 'user_role_change_superadmin' );
with:
add_action( 'woocommerce_order_status_completed', 'user_role_change_superadmin' );
And this fixed the problem
Thanks @Jacob Peattie
Related Posts:
- Edit Yoast SEO breadcrumbs output [closed]
- Redirect to another page using contact form 7? [closed]
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Customizing subject in comment notification e-mails
- How to Loop Plugin Option Field Set?
- Saving Plugin settings to the database
- Post source link plugin – small modification
- Add CSS animation as Preloader to WordPress
- How to list the Hooks and order of execution in current loading page? [duplicate]
- HELP: Integrating WP with raw PHP code once published button is hit
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- Scope for PHP Variables Assigned in functions.php or a plugin
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- wordpress plugin is not activating from widget
- How would I go about creating a user ranked post popularity page?
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Conditional attributes and logic per product category
- WordPress get_avatar function not correct working
- Check if variable is set in filter
- execute function after one completed
- Plugin onclick button activate other plugin
- Loop in elementor custom widget not working
- Why is it important to check for isset and is_array before checking in_array in this example?
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- Calling a save function from a “submit” button
- same user role or copy the user role to be same as the other role
- Different registration form for different roles
- More gentle way to hook WordPress custom url
- How to add custom function to pluggable.php
- Checkbox show / hide output result
- How to keep plugin (media-sync) running even the tab is closed?
- implement custom roles in custom plugin
- Allow a particular user to access a particular plugin?
- Cookie value changes back to previous value after changing
- Post source link plugin – small modification
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- adding dynamic/multiple slug values in ‘option_none_value’
- Adding discount functionality to the cart
- How to assign a specific service to a specific provider based on location
- Precheck fields when I add a new post
- Rename a folder via HTML POST request
- Move plugin pages from dashboard to front-end
- Is admin section completely customizable in terms of styling?
- Woocommerce list variations that are added already to cart in Single Product
- register_activation_hook doesn’t fire at all
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- Populate select option with JSON file
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- How to add a handler for a button in plugin?
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- Doing action based on input from options menu
- How use Dynamic hyperlink on each wordpress post?
- What can I do to customize a widget provided with this plugin? from where have I to start?
- WordPress: code structure
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How to make a Template page to show the information of different things Shop and Product page?
- Mixed results with is_page() WordPress function, when using $this, or self
- Read page- or post-content across different builder-plugins
- Best collection of code for your 'functions.php' file [closed]
- How to structure a plugin
- What are the differences between WPINC and ABSPATH?
- show_admin_bar filter not called inside plugin class
- REST API – filters not working inside plugin class
- How to make WordPress Plugin run on single specific Admin Page
- WordPress site server getting blocked due to resource abuse
- Error 400 Invalid “products[1].productId” Kinguin [closed]
- Plugin question, How to insert a colon in a value box
- Woocommerce attatch files and custom input meta to cart items and then to order
- Need to add custom cart item data
- How to add usermeta for existing users when user profile is updated
- wp_head filter not executed inside custom class
- redirect logged users to custom front-end insetad of wp-admin
- Redirrect after facebook successful login to wooommerce cart page url
- How to fetch WordPress Gallery Images to a Custom Post Type?
- Add 2 links in between the navigation using the Breadcrumb Navxt plugin hook
- Remove custom menu pages for admin users
- Custom uploader – Upload files and save link into database
- Implement Google SSO in custom plugin
- Unable to use correctly composer autoload in plugin file
- CPU Overloading due to some hooks
- WooCommerce Checkout – Validate User Role
- I have issue to retrive post thumbnail with rest api
- Woocommerce change image based on a single attribute
- Custom block based off core block using filter
- Remove H1 title in admin post edit screen
- Custom plug-in issues
- Custom Search Function in WordPress Returns No Results
- Call to undefined function create_function() – PHP 8.2
- How to get next day date of a specific day
- can not serialize and insert data from custom form
- Custom page template from plugin does not work with pre-installed themes in WordPress 6.6.1
- How can I keep a WordPress dropdown menu open when navigating to a child page?
- Custom Dynamic Tag in Elementor not showing image
- Elementor: Exclude product categories when using “Source: Current Query”
- how to add custome text in each products side in checkout page after pincode validation [closed]