简体   繁体   中英

Create custom URL for WordPress RSS2 Feed

I wrote an RSS2 feed on WordPress a while back, but for some reason, some of the URLs aren't working anymore. The current version of WP is 4.7.2.

For example, https://justhoodsbyawdis.com/product/jh001/feed/ works, but https://justhoodsbyawdis.com/brands/feed/ does not.

Note that https://justhoodsbyawdis.com/product/jh001/ is a valid page on the site, but that https://justhoodsbyawdis.com/brands/ is not, because it is only valid for feeds. The latter results in an "ERROR: This is not a valid feed." message.

Is there a way to make an URL for a RSS2 feed, even without an associated WP page (ie without the "/feed/" at the end).

Thanks!

Rob

EDIT 1:

I added a post called "brands", which fixed the problem. The only thing is that the dummy post is viewable by anyone. Any ideas how to block it, but not the feed?

Another problem is that query strings break the feed, for instance: https://justhoodsbyawdis.com/products/feed/?name=hoodies doesn't work, although it does without the "?name=hoodies".

How would I make that work?

EDIT 2:

It would appear that the name query string parameter is now causing problems - see:

https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms

Is there a way to make it backwards compatible? Otherwise, the existing app that calls the feed will also have to be changed...

I wound up creating dummy pages to fix the invalid feed error.

I had to change the "name" query string parameter to "prod_name" so as to not conflict with reserved terms.

Rob

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