Why do you need an unlikely integer in paginating?

Note the get_pagenum_link( $big ): This will create an URL (not a link) based on the number provided in the first parameter.

That function is used to get the basic pattern for the URL, and the high integer is used here, because:

  1. You must provide an integer as argument.
  2. The resulting URL is filtered with apply_filters('get_pagenum_link', $result) and might be changed by plugins. This risk is slightly higher for numbers matching existing pages, for example when a plugin implements separate titles for sub-pages.

So this is just a … dirty convention, a signal to other plugins: Don’t change that please! I think PHP_INT_MAX would have been better, but still ugly. And I wonder how many plugin developers know that.

The number is then replaced with the placeholder needed in paginate_links().

What you see here is an incomplete API. Try to learn something from this example – do not release incomplete APIs, or your docs will look embarrassing. 🙂

Leave a Comment