I had to create a custom post type, let’s call it ‘trucks’. The link to the archive of the posts looks like that: http://example.com/wpdirectory/?post_type=trucks
I want it to look like that: http://example.com/wpdirectory/trucks without the ‘?post_type=’ query. How can I affect it?
Leave a Reply
You must be logged in to post a comment.
I found out that it can be specified directly when registering new post type using register_post_type:
use the argument
'has_archive' => 'your-desired-archive-permalink'
in my case:
'has_archive' => 'trucks'
Try using the
add_rewrite_rule()
function is your functions.php file. Try this:Otherwise you can overwrite the permastructures in
Settings -> Permalinks
in WordPress and hard code it in.