I am looking for a way to rewrite my custom post type feed located at
http://localhost:8888/feed/?post_type=post
to
http://localhost:8888/feed/portfolio
this post suggests using
http://localhost:8888/portfolio/feed/
which is not the main feed but the comments feed, any ideas?
http://localhost:8888/portfolio/feed
currently the above goes to comments as well.
Put this in a plugin or
functions.php
:When you’ve done that, go to the permalinks page and resave to flush your old rules and regenerate them
Remember, when changing rewrite rules to use the monkeyman rewrite analyser tool plugin to check what rules are used for which URLs
If you have the archive on CPT to true, that creat WP always a feed, the nice URL is only usable, after you refresh the permalinks via Settings in Backend or via a function in your code. Important is the name of your CPT, should the name is “portfolio”. If you have another name, then you must create a rewrite, maybe with
wp_rewrite()
or via rules inside the .htaccess File, if it is a a Apache server.