简体   繁体   中英

Change URL of custom post type in wordpress

Currently, I have URL like

/recipes-detail/?recipe=(Slug of recipe)

How Can I change this to

/recipes-detail/(Slug of recipe)

Currently, I am fetching the recipe custom plugin.

将固定链接设置更改为帖子名称

You can add to the .htaccess file a rewrite mode

RewriteRule ^recipes-detail/[a-z0-9]+(?:-[a-z0-9]+)*$/  ./recipes-detail/?recipe=$1

Now if you use this address yourwebsite.com/recipes-detail/cake-of-chocolate will work exactly as you will be doing yourwebsite.com/recipes-detail/?recipe=cake-of-chocolate

So you can now build your urls with the friendly option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM