[wp-hackers] prevent theme's functions.php from loading in wp-settings

Paul Menard paul at codehooligans.com
Mon May 5 15:57:02 UTC 2014


Nick,

I'm using SHORTINIT in another area of the AJAX handler when I don't need
to load the entire WP environment. So yes, I'm aware of how this works.
Have not tried WP_INSTALLING. And agree it seems hack-ish. But might just
work.

To restate when I define WP_USE_THEMES as false I would expect no part of
the theme to be loaded including the theme functions.php. This is
regardless of using my own AJAX handler. What if I were just side-loading
WordPress and needed WP core functionality but not the theme?

Not a big issues. I'm already gaining a large efficiency using the
SHORTINIT and bypassing loading all the plugins for each request.


Nikola,

Correct. When using the WP admin-ajax handler it loads all plugins into the
environment before servicing the specific ajax handler. This is expected.
And this is where I'm using my own handler. Then I can decide what parts of
WP I needed to load.

Paul




On Mon, May 5, 2014 at 11:07 AM, Nikola Nikolov <nikolov.tmw at gmail.com>wrote:

> WP Ajax handlers(the one at /wp-admin/admin-ajax.php) load all plugins and
> themes as well(since themes can also register AJAX action handlers).
>
>
> On Mon, May 5, 2014 at 5:56 PM, Nicholas Ciske <nl at thoughtrefinery.com
> >wrote:
>
> > Tried define( 'SHORTINIT', true ); ? That keeps wp-settings.php from
> > loading in the first place.
> >
> > What if you define 'WP_INSTALLING' to something? That would seem to
> > preclude the loading of functions.php -- but feels hacky.
> >
> > See also:
> >
> >
> http://wordpress.org/support/topic/load-wp-core-in-another-framework-shortinit-wp_query
> >
> > Or perhaps you need to reframe the problem and just use a WP Ajax handler
> > instead?
> >
> > _________________________
> > Nick Ciske
> > http://thoughtrefinery.com/
> > @nciske
> >
> > On May 3, 2014, at 6:29 PM, Paul Menard <paul at codehooligans.com> wrote:
> >
> > > Thanks Andrew. But my point was more about the theme functions.php
> being
> > > loaded at all from wp-settings.php. Sure I can figure out a way to
> short
> > > circuit the get_options call but that is for TwentyFourteen. What is
> > there
> > > is another theme used and the functions.php does many other queries I
> > > really don't want? Just seems less efficient not being able to control
> > this
> > > via the WP_USE_THEMES define.
> > >
> > > P-
> > _______________________________________________
> > 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