There are a number of issues here:
every_minutedoesn’t exist as a cron schedule, so while you’ve successfully scheduled the cron job, WordPress doesn’t know when to run it.- keep in mind that WP Cron isn’t precise, if nobody visits your site it won’t run, so it won’t run every minute unless your site is heavily trafficked and uncached. A system cron trigger would make this more reliable.
- Register the new cron schedule, here’s an example from the plugin handbook https://developer.wordpress.org/plugins/cron/understanding-wp-cron-scheduling/
- The code binds that the class method/functions to the hook dynamically, but those are static methods, either remove the
statickeyword or use the class name instead of$this - You’re assuming that
wp_insert_postalways works, it can fail! It returns a post ID or a failure value, assign it and check that value so you can report that something went wrong
Finally, WP Cron issues can also be debugged using WP CLI or plugins such as wP Crontrol that let you view what has been scheduled, when, and if they’re overdue.