WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get WP is using Mod_Write or $_GET for URLs,
Because by it, I can generate my own links like:

mysite.com/val1/val2

or in a conventional way;

mysite.com/?var1=val1&var2=val2

$_GET or rewrite, how to detect that which way WP is currently using?

share|improve this question
up vote 1 down vote accepted

You can check for the permalink_structure option value. If this value is an empty string, WP is using the default permalink structure (/?var1=val1&var2=val2), otherwise WP will be using the pretty permalink structure (/val1/val2):

if ('' != get_option('permalink_structure')) {
    // pretty permalink '/val1/val2'
    ...
} else {
    // default permalink '/?var1=val1&var2=val2' 
    ...
}
share|improve this answer
    
Thank you Ahmad, this is very simple and what I am looking for – Digerkam Feb 7 '13 at 12:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.