PHP script scheduled with cronjob not working
-
Hello, I need help to understand how to actually execute PHP code on WordPress, because I feel like I’m doing something wrong. So, what I tried is to write (actually, modify from an online example) some PHP code to update my WooCommerce products stock based on data from a CSV that sits in the “wp-content/upload” folder, following this guide:
https://rudrastyh.com/woocommerce/update-product-stock-from-csv.html
My code is for now equal to this one, I just changed the name of the file to test it and added <?php at the start of the file. The file with this PHP code is in the root, and I put the code to schedule the execution in functions.php. The question is, it doesn’t seem to work. If I go and see from the plugin Query Monitor, I can’t see it running. Same if I check processes running from my host command line. And also WP Activity Logs, another plugin, doesn’t notify stocks actually changing. It doesn’t seem the script is going at all, what am I missing? The code seems right, and also using WP-CLI to start the script doesn’t seem to work. Same if I open it going to mywebsite.com/myfile.php, I just get a blank page. I ran out of options, could someone clarify? Thank you in advance.
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.