Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

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.