ActionScheduler_wpPostStore::unclaim_action()publicWC 1.0

Unclaim action.

Method of the class: ActionScheduler_wpPostStore{}

No Hooks.

Return

null. Nothing (null).

Usage

$ActionScheduler_wpPostStore = new ActionScheduler_wpPostStore();
$ActionScheduler_wpPostStore->unclaim_action( $action_id );
$action_id(string) (required)
Action ID.

ActionScheduler_wpPostStore::unclaim_action() code WC 8.7.0

public function unclaim_action( $action_id ) {
	/**
	 * Global wpdb object.
	 *
	 * @var wpdb $wpdb
	 */
	global $wpdb;

	//phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
	$result = $wpdb->query(
		$wpdb->prepare(
			"UPDATE {$wpdb->posts} SET post_password = '' WHERE ID = %d AND post_type = %s",
			$action_id,
			self::POST_TYPE
		)
	);
	if ( false === $result ) {
		/* translators: %s: action ID */
		throw new RuntimeException( sprintf( __( 'Unable to unlock claim on action %s. Database error.', 'woocommerce' ), $action_id ) );
	}
}