[wp-hackers] Is WP_INSTALLING constant here to stay?

John Blackbourn johnbillion+wp at gmail.com
Tue Jan 22 14:47:29 UTC 2013


On 22 January 2013 13:17, Dino Termini <dino at duechiacchiere.it> wrote:
> Good morning, all,
>
> for a plugin I'm working on, I need to user some WordPress functions in an
> external file. I'm loading it with the usual wp-load.php include, but
> apparently some plugins don't like that, and throw a fatal error, breaking
> my code. Thanks to St. Google, I found out that there's a constant that can
> be used to tell Wordpress to not load any plugins:
>
> define('WP_INSTALLING', true);
>
> Now my question to core developers is if this approach is correct and if I
> can rely on it for the foreseeable future. Otherwise, my question becomes:
> what is the best way to load just the CORE without all the stuff added by
> plugins and themes?

Rather than trying to solve your problem by preventing other plugins
from loading, you should instead solve it by finding the correct
method to do what it is you want to do. In other words, you should
treat the cause of your problem, not the symptoms.

Your main issue is that you're manually including wp-load.php, which
you should avoid. There are better methods. Otto has a good blog post
on the subject [1]. One thing that Otto didn't touch on is using
admin-ajax.php too, for loading resources or fulfilling requests. This
is worth looking in to.

Secondly, your post is a prime example of the XY problem [2]. You're
concentrating on your attempted solution rather than asking advice
about your actual problem. It might be worth starting another thread
detailing your actual problem, then hopefully someone can help out!

John

[1] http://ottopress.com/2010/dont-include-wp-load-please
[2] http://meta.stackoverflow.com/questions/66377/what-is-the-xy-problem


More information about the wp-hackers mailing list