you can Go to
Dashboard → Settings → Permalinks like this : /%category%/%postname%/ and select a custom structure (whatever you want).but it is only use in category and post slug. and you can use custom code also. in function.php