We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I defined the following route:
Routes::map('category/:category/:subcategory', function($params) { $category = $params['category']; $subcategory = $params['subcategory']; $query = new \WP_Query(array( 'post_type' => 'post', 'category_name' => $category, 'tax_query' => array( array( 'taxonomy' => 'secondary_category', 'field' => 'slug', 'terms' => $subcategory, ), ), )); Routes::load('archive.php', array('category' => $category, 'subcategory' => $subcategory), $query); });
But I get the error:
Warning: parse_str() expects parameter 1 to be string, object given in /upstatement/routes/Routes.php on line 139
In fact you just need to pass the arguments array, not a WP_Query object:
Routes::map('category/:category/:subcategory', function($params) { $category = $params['category']; $subcategory = $params['subcategory']; $query = array( 'post_type' => 'post', 'category_name' => $category, 'tax_query' => array( array( 'taxonomy' => 'secondary_category', 'field' => 'slug', 'terms' => $subcategory, ), ), ); Routes::load('archive.php', array('category' => $category, 'subcategory' => $subcategory), $query); });
The text was updated successfully, but these errors were encountered:
You are a scholar and a gentleman. This was killing me.
Sorry, something went wrong.
No branches or pull requests
I defined the following route:
But I get the error:
Warning: parse_str() expects parameter 1 to be string, object given in /upstatement/routes/Routes.php on line 139
In fact you just need to pass the arguments array, not a WP_Query object:
The text was updated successfully, but these errors were encountered: