template_include versus template_redirect used by plugin
-
Howdy.
I will try to keep this brief. I am wanting to add a custom slug to the WP_Rewrite so that all URLs under a specific URI are re-routed to my plugin and bypasses the default theme altogether.
An example:
Normal Functionality -|
https://www.example.com/cat/postname/Add This -|
https://www.example.com/my-slug/whatever/whatever-elseI am using MVC or my plugin, so I want to send anything under /my-slug/ to my own router that will then call the correct controller and so on. None of these controllers use the WP Themes. They have a totally separate design. This can all happen before the wp_query, but it doesn’t have to.
I have noticed two ways to do this using hooks: template_include and template_redirect
My question is: which of these is cleaner? Is there one that would be a better choice for performance? I would like to avoid using exit() at the end of my intercept so that (after my page has been executed) WordPress can continue with its shutdown functions.
Thank you,
Michael
- The topic ‘template_include versus template_redirect used by plugin’ is closed to new replies.