http://example.com/my-great-article/?all_pages=1. But this doesn’t play nice with full page caching provided by batcache. To leverage full page cache we need to use the WP_Rewrite API, you can use rewrite endpoints Or use the add_rewrite_rule() and add_rewrite_tag() functions (guide here)
But wait — there’s more!
You can even speed up ajax requests with this technique.
http://example.com/ajax/my_frontend_ajax_function/parameter_1/to make ajax requests that are cached for 5 minutes for all users with batcache. This will make request time go down often 100 folds! Note that the ajax rewrites are to index.php and not to admin-ajax.php. You are creating a new endpoint that will call your PHP function, not rewriting the query to pass to admin-ajax.php