Can a link in WordPress contain a query string that is picked up as $_POST
This question is about a very specific circumstance.
-
A template file can run a default category query with thumbnail, linked title and excerpt, or it can run a linked title only depending on a viewer choice. That is, once on the category page, the viewer can click a List Only option. https:// domain/category/ glossary-of-wood-terms ?format=list This part works fine.
-
The second option (linked title only) should pick up the whole dataset, not a paginated dataset.
-
Using a pre_get_posts, I can set the query to get the whole dataset (not paginated) with
$query->set( 'posts_per_page', -1 );
and an if test that will only run that code on a particular URL. Here is where the problem lies.
It turns out that WordPress sees the address as https://domain/category/glossary-of-wood-terms?category_name=glossary-of-wood-terms with the query string hidden. But WordPress is treating it as a $_POST variable not a $_GET variable.
What address should I used in the pre_get_posts test?
Leave an answer