Intercepting $_GET variable from custom pagination

In your function, you can use $_GET and do all the validation you want to:

  • You can look if it’s greater than 0

  • if it’s a string or an integer

    And then use wp_redirect to go the error page or whatever page you want.