WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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'm looking for a way to create an if...else statement hinging on whether pretty permalinks are active or not. So I need something which returns true when permalinks are changed from the default.

if (pretty_permalinks_are_on) {
   do this;
    } else {
       do that;

Sort of thing. Just have no idea about the 'pretty_permalinks_are_on' part.

If anyone would extend the hand of compassion and throw some crumbs to a php noob, I'd be a grateful learner :)

share|improve this question
up vote 1 down vote accepted

get_option( 'permalink_structure' ) is your friend. If you're using the default it will be set as an empty string:

if( get_option( 'permalink_structure' ) !== '' ) {
    // custom permalink enabled code
} else {
    // no permalink 
share|improve this answer
Brilliant! Thanks Simon – Rothbert Jan 17 '12 at 0:19

Your Answer


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.