Error related to found_posts_query filter usage
-
I’ve run into what appears to be a bug with the 6.0.5 version of The Events Calendar. This is the error being thrown:
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function TEC\Events\Custom_Tables\V1\WP_Query\Custom_Tables_Query::filter_found_posts_query(), 1 passed in /app/wp/wp-includes/class-wp-hook.php on line 308 and exactly 2 expected in /app/wp/wp-content/plugins/the-events-calendar/src/Events/Custom_Tables/V1/WP_Query/Custom_Tables_Query.php:575From what I can tell by looking at both the plugin and WP core code, the reason for this error is that the
found_posts_queryfilter being used to callCustom_Tables_Query::filter_found_posts_querypasses its arguments in a single array, but the method in your class expects there to be 2 separate arguments passed.I can confirm I get this error with the 6.0.5 version of the plugin, but not with the 6.0.3.1 version.
I did some local testing, and believe this should fix the issue:
Change the method from:
public function filter_found_posts_query( $found_posts_query, $query ) { // Rest of your method here }to:
public function filter_found_posts_query( $args ) { [$found_posts_query, $query] = $args; // Rest of your method here }
The topic ‘Error related to found_posts_query filter usage’ is closed to new replies.