Can a link in WordPress contain a query string that is picked up as $_POST

Question

This question is about a very specific circumstance.

  1. 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.

  2. The second option (linked title only) should pick up the whole dataset, not a paginated dataset.

  3. 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?

0
, , , Nora McDougall-Collins 3 years 2020-05-30T18:11:51-05:00 0 Answers 97 views 0

Leave an answer

Browse
Browse