[wp-hackers] Custom Permalink Rewrite Rules

Matt Slocum mattslocum at sharefaith.com
Wed Aug 22 23:50:34 UTC 2012


Hi all,

I'm trying to add my own custom url structure to my plugin that will allow
a specific url to access a different php file. For example, I want
www.domain.com/awesomeness/ should load a special php application in my
plugin: wp-content/plugins/myplugin/awesomeness.php. This 'awesomeness.php'
file will do its own thing and call exit().

I was trying to do all this using a rewrite rule, but I can't get it to
work. I've resorted to hooking the wp_loaded action and looking in
$_SERVER['REQUEST_URI'] to see if it matches. The thing is, I still don't
want to allow users to make a page/post called 'awesomeness' because it no
longer is navigable. So it seems like I still need to add a custom
add_rewrite_rule().

Other thought: I've also thought about using add_feed() or
add_rewrite_endpoint() because then my awesomeness script would know what
page to work on. My current method will know what page to work on based on
what comes after /awesomeness/ (ex:
www.domain.com/awesomeness/my-normal-page/).

Sorry about being vague here. Please don't let my adding of a new tag
distract the conversation of how to add the custom permalink structure.
:-)  Does anyone have any experience doing odd rewrites or have any
articles about it?

Thanks,
Matt


More information about the wp-hackers mailing list