The permalinks in WordPress are generated by
WP_Rewrite class in
wp-includes/rewrite.php. It translates the URL being entered into the browser into query variables which are then used by
WP_Query to determine which content will be loaded.
There are rewrite rules which define the structure of permalinks.
Categories are structured by default as
Pages are structured as
For posts, it is
custom_structure is what you define on the Settings > Permalink on admin page.
Pages, by default, reflect their parents. So third level page will have:
THE NAVIGATION MENU
The navigation menu doesn't reflect the permalink, it depends on how user will build the structure of the menu.
So, if you need the menu to follow the page structures, create a menu based on them. Having the permalink structure follow your menu takes more effort than you could imagine.
Having custom permalinks requires these actions:
- You have to create custom structure for each part of your page which
are categories, tags, port_formats, taxonomies, posts etc.
- You have to create rewrite rule for them as well.
- You have to make sure that they don't conflict each other.