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?
- Best collection of code for your 'functions.php' file [closed]
- Should all plugins be encapsulated in a Class?
- if plugin is active? check if plugin is enabled or not?
- Making plugin unique to not conflict with plugins with the same name
- How to find out if option exists but is empty?
- Errors while using ajax from external wordpress page
- Setting up widgets in wordpress with a unique ID for the after_title argument
- Where should I save an API key of my user when installing my plugin?
- Custom form action to handle data inside a plugin
- WP Post Template – Templates in own folder
- Image upload and download from front-end
- custom payment gateway in woocommerce failed to connect to remote api server
- How to call WordPress function other files
- Ajax call returning 0
- What is @Action in WordPress?
- Inserting custom PHP script on homepage
- wp_enqueue_scripts
- Save user total active time after login in wordpress [closed]
- Wp Debug Enabled True Notices and Warning
- My widget won’t update its values when save is clicked
- Unexpected add action function in WP plugin
- Prevent WordPress from sending set-cookie http header
- Block plugin update possibilities (but not by hiding notifications)
- Load my Inline js footer area
- Move plugin upload folder from mywebsite.com/wp-content/uploads/pdfuploads to mywebsite.com/pdfs?
- Soflyy WP All Import Custom File Download Issue
- WordPress Admin sub-level menu issue
- Passing ajax variable to more than one wordpress plugin function
- Custom pages with plugin
- Displaying friend’s posts only
- Why isn’t my plugin seeing other classes?
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- Contact Form 7: custom validation [closed]
- How to add custom html to the Media > Attachment Details modal?
- How to disable plugin capability : “create new category”
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- How to override plugin function in code snippets WordPress
- How to create a “Most Popular” & “Latest” TAB in WordPress
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode