Forums

add_rewrite_endpint() / WP_rewrite::add_endpoint don't seem to honour $places (2 posts)

  1. johnnyb
    Member
    Posted 3 months ago #

    I'm working on a plugin that needs to add the ability to append /outputxml/ to all WP URLs, and have those URLs resolve as if they did not have /outputxml/ on them.

    I have this working for Permalinks to posts, but I get a 404 error whenever I use any other type of URL. You can see what I did to get this working on permalinks here: http://johnbeales.com/20090824/endpoints-a-little-secret-for-url-manipulation-in-wordpress/

    It seems that in my register_activation_hook function, when I call add_rewrite_endpoint() it only adds the endpoint to permalinks, not to category views, archives, the root, (blog home URL), or anything else that I've discovered. I have passing an array of all different URL types that exist as my $places variable. I have also tried just using, for example, EP_MONTH. In both situations the endpoint only resolves for permalinks, but not for any archives or any other URLs. I have also tried EP_ALL with the same result.

    I am deactivating and reactivating my plugin after every change.

    Does anyone out there know what I should be doing to make my endpoints work on all URL types, (well, maybe except for attachments)?

    Thanks in advance

  2. johnnyb
    Member
    Posted 3 months ago #

    So, I think I figured it out. Apparently I shouldn't give an array as $places, as the in-code docs say. It works if I set EP_ALL, with no array.

Reply

You must log in to post.

About this Topic