[wp-hackers] Custom Permalink Rewrite Rules

Matt Slocum mattslocum at sharefaith.com
Fri Aug 24 00:24:12 UTC 2012


Thanks Peter,
I've never used that hook. In this unique case I think I'll stick with
wp_loaded because if my test matches I'm going to stop the normal WordPress
execution, and I don't need all the admin_bar and style execution. I'm glad
to see the template_redirect because I might incorporate that too in a
different area.

Matt

On Wed, Aug 22, 2012 at 5:23 PM, peter baylies <
pbaylies at semperfiwebdesign.com> wrote:

> Matt,
>
> Would the template_redirect action work for what you're doing here?
>
> http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect
>
> Cheers,
>
>  -- Peter Baylies
> Semper Fi Web Design
>
> On Wed, Aug 22, 2012 at 7:50 PM, Matt Slocum <mattslocum at sharefaith.com
> >wrote:
>
> > 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
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list