1

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 :)

1

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 
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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