I need to make if statements for every permalink structure, so I need to know if there is a function that returns to me the actual selected permalink structure by the user.
To make it simple all I need to know is if this permalink:

www.site.com/?p=22;

a condition will apply else if this structure

www.site.com/cat/title

is used then another condition is applied.

So all I need to know is if there is function in WordPress that can return me what structure the website is using.

1 Answer
1

The structure is stored in the option permalink_structure. Pretty permalinks are disabled if the option is empty.

$structure = get_option( 'permalink_structure' );

Leave a Reply

Your email address will not be published. Required fields are marked *