Seeing as I’ve just spent at least 10 minutes looking for this before figuring it out on my own, I figured it would be useful to have here. The issue is as follows: “How does one check if WordPress is currently using ‘pretty permalinks’ or if it’s just using a GET variable?” This issue is important for example, when you’re writing GET forms that operate on the frontend. Unfortunately, you have to add the
page_id param back into the URL (usually through a hidden input), otherwise WordPress will route the query to the homepage.
Anyway, here’s the solution:
if ($wp_rewrite->permalink_structure == '')
//we are using ?page_id
//we are using permalinks
It’s that easy.