Exclude 'page:x' from params()

Hey there,
quick question: I want to filter something depending on if there are params applied, like category, tag, you name it. But params() is also true if there’s pagination on, like ‘page:2’ etc

Now, if I check if ‘page’ exists inside params() array, that would on the other hand filter out paginated taxonomy pages, like category:xxx/page:x, whch I also don’t want. I want to check if there’s JUST ‘page:x’ parameter present.

Any suggestions?

You can use an if statement similar to this one:

if(count(params()) == 1 && ($param = param('page'))):
  // do something
endif;

First, check if there is only one param in the params array, then check if this one is the page param.

1 Like

THX! that worked flawlessly