How To Set WordPress Permalinks From functions.php

How To Set WordPress Permalinks From functions.php

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:

http://www.example.com/?p=22

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:

You can change the structure of your permalinks with following structure codes: