Permalinks are the permanent URLs to your WordPress or blog posts, as well as pages and other things on your WordPress blog or any other website. It’s very important to have an easy permalink structure for your URLs for better navigation and SEO. The default WordPress permalinks looks like this:
You can easily change the structure of your permalinks in the settings of your WordPress but you can also change the structure from your theme’s functions.php file.
Add following snippet to your theme’s functions.php file:
// set permalink
You can change the structure of your permalinks with following structure codes:
The year of the post, four digits, for example 2004
Month of the year, for example 05
Day of the month, for example 28
Hour of the day, for example 15
Minute of the hour, for example 43
Second of the minute, for example 33
The unique ID # of the post, for example 423
A sanitized version of the title of the post (post slug field on Edit Post/Page panel). So “This Is A Great Post!” becomes this-is-a-great-post in the URI.
A sanitized version of the category name (category slug field on New/Edit Category panel). Nested sub-categories appear as nested directories in the URI.
A sanitized version of the author name.