Hello @aurovrata
I’ve looked into the provided RC and I’m not sure this issue is fully resolved.
I think the issue is with the following line:
$ob = explode(' ', trim($wp_query->query_vars['orderby']));
WP_Query orderby can be a String or an Array and the above line will error out when an Array is provided since trim()
expects a String. One option may be to force an array then compare against array_keys()
and array_values()
. I’m not sure if trim()
is necessary but this could be mapped to the array before the comparison.
Here’s the stack trace I get with my Fatal Error:
Array
(
[type] => 1
[message] => Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /wp-content/plugins/reorder-post-within-categories/public/class-reorder-post-within-categories-public.php:421
Stack trace:
#0 /wp-content/plugins/reorder-post-within-categories/public/class-reorder-post-within-categories-public.php(421): trim()
#1 /wp-includes/class-wp-hook.php(307): Reorder_Post_Within_Categories_Public->override_woocommerce_products()
#2 /wp-includes/plugin.php(189): WP_Hook->apply_filters()
#3 /wp-content/plugins/reorder-post-within-categories/public/class-reorder-post-within-categories-public.php(260): apply_filters()
#4 /wp-content/plugins/reorder-post-within-categories/public/class-reorder-post-within-categories-public.php(147): Reorder_Post_Within_Categories_Public::is_ranked()
#5 /wp-content/plugins/reorder-post-within-categories/public/class-reorder-post-within-categories-public.php(85): Reorder_Post_Within_Categories_Public->is_manual_sort_query()
#6 /wp-includes/class-wp-hook.php(307): Reorder_Post_Within_Categories_Public->filter_posts_where()
#7 /wp-includes/plugin.php(233): WP_Hook->apply_filters()
#8 /wp-includes/class-wp-query.php(2625): apply_filters_ref_array()
#9 /wp-includes/class-wp-query.php(3542): WP_Query->get_posts()
#10 /wp-includes/class-wp-query.php(3653): WP_Query->query()
#11 /wp-content/themes/custom-theme/template-parts/programs/term-posts.php(36): WP_Query->__construct()
#12 /wp-includes/template.php(772): require('...')
#13 /wp-includes/template.php(716): load_template()
#14 /wp-includes/general-template.php(204): locate_template()
#15 /wp-content/themes/custom-theme/taxonomy-tax_program_type.php(26): get_template_part()
#16 /wp-includes/template-loader.php(106): include('...')
#17 /wp-blog-header.php(19): require_once('...')
#18 /index.php(17): require('...')
#19 {main}
thrown
[file] => /wp-content/plugins/reorder-post-within-categories/public/class-reorder-post-within-categories-public.php
[line] => 421
)