Created
May 5, 2025 19:03
-
-
Save lcatlett/576d9d890a5a5da6b4bb0f2202cd2704 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Plugin Name: Fix JSON Support Detection for Action Scheduler | |
* Description: Fixes the JSON support detection in Action Scheduler for MariaDB on Pantheon | |
* Version: 1.0.0 | |
* Author: Lindsey Catlett, Pantheon | |
*/ | |
// Make sure this runs before Action Scheduler initializes | |
add_action('plugins_loaded', 'fix_json_support_detection', 5); | |
function fix_json_support_detection() { | |
// Override the JSON partial matching check in ActionScheduler_DBStore | |
add_filter('action_scheduler_claim_actions_sql_where', function($where_clause) { | |
// If the error is happening, the user is trying to use JSON partial matching | |
// This filter runs when the store is querying for actions | |
if (isset($_REQUEST['action']) && | |
($_REQUEST['action'] === 'elementor_optimize_image' || | |
$_REQUEST['action'] === 'elementor_bulk_optimize_images')) { | |
// Force the partial_args_matching to 'like' instead of 'json' | |
add_filter('action_scheduler_get_actions_query_args', function($query_args) { | |
if (isset($query_args['partial_args_matching']) && $query_args['partial_args_matching'] === 'json') { | |
$query_args['partial_args_matching'] = 'like'; | |
} | |
return $query_args; | |
}, 5); | |
} | |
return $where_clause; | |
}, 5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment