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

1 Answer

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
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.