Created
November 18, 2024 10:25
-
-
Save nathan-roberts/95521ce11e47a3f6aeceb6f549d120b6 to your computer and use it in GitHub Desktop.
Action Scheduler Test Run Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('wp-load.php'); | |
// Load the Action Scheduler library | |
if (class_exists('ActionScheduler')) { | |
$action_id = 11; | |
$sql = "UPDATE `local`.`wp_actionscheduler_actions` SET `status` = 'pending' WHERE `action_id` = " . $action_id . ";"; | |
$result = $wpdb->query($sql); | |
// Get the action object by ID | |
$action = \ActionScheduler::store()->fetch_action($action_id); | |
var_dump($action); | |
if ($action) { | |
// Execute the action | |
$action->execute(); | |
echo "Action with ID $action_id has been executed."; | |
} else { | |
echo "Action with ID $action_id not found."; | |
} | |
} else { | |
echo "Action Scheduler class not found."; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment