[wp-hackers] About using WordPress as service and themes

Filippo Pisano filippo.pisano at gmail.com
Thu Jul 18 07:08:17 UTC 2013


I was trying to figure out a good way to prevent themes from being included
when calling WordPress with a particular query string.

Here's an example of what I'm trying to do:

/pages/my-page -> Classic page.php from my_theme_directory
/xml/my-xml-page -> XML page served to external script through custom plugin

I want to exclude the XML generating routine from themes because I want to
speed up things avoiding to load theme's callbacks and functions.

I've tried to set the WP_USE_THEMES constant to false but the functions.php
file belonging to the active theme is still included.
I think that a possible solution could be to add an additional xml-only
theme and change active theme on the fly accordingly to the query string.

IMO such a solution could have an unwanted overhead because all formatting
and templating libraries are also included (despite I need to render a
simple XML only).

Could you suggest me a better way?

Thank you

More information about the wp-hackers mailing list