Load Minimum of WordPress

A small contribution for all those using WordPress as a backend, framework or something similar. The applications, especially in the B2B sector, becoming more and more, as do the questions.

So far, I’ve always liked to recommended BackPress. But even a well-maintained standard is feasible, with all its advantages in the context of the philosophy of updates. WordPress reduces initializing to a minimum, if the constant SHORTINIT is set.

The wp-settings.php of WordPress is the key.

// Stop most of WordPress from being loaded if we just want the basics.
	return false;

Thus, the loading process is much slimmer and files that are loaded later, must be integrated via a Plugin or Theme functions. The ability is worth it and not infrequently, the part of WordPress in some projects is so small compared to your own developments, that this is worth to do.

Activating in wp-config.php via define( 'SHORTINIT', TRUE ); is done quickly and you can start the test, but note: the globals $wp, $wp_query, $wp_the_query was set as NULL.

Comments are closed.


  1. Bjorn van der Neut

    If I add this I get the next error:

    Fatal error: Call to a member function main() on a non-object in /var/www/vhosts/ttweesp.nl/httpdocs/wp-includes/functions.php on line 1570

    What am i doing wrong?

  2. Frank

    @Bjorn: clean install? WP set this constant on a Multisite install also to.

  3. Simon

    define(‘SHORTINIT’, true); seems to set the globals $wp, $wp_query, $wp_the_query as null and this causes the error that Bjorn gets (I also get the same error).

    Seeing if there is a way around this. Otherwise it seems setting it in wp-config.php is not the best idea.

    FYI – this is on a clean install or wp 3.3.1

  4. Frank

    @Simon: i think you must set the constant in a plugin or theme, there is the biggest part to use WP as Framework. But to check, how and what works with this smaller WP is the config the right part. Thanks for your helpfull reply!

  5. David Wood fin

    Thank you for your nice article. It will help me.

  6. Cristian

    Great as always guys, I was looking for something like this!

    Please, can you give me a hint on how to start after enabling the SHORTINIT?
    I mean, I imagine that I’ve to include a WP “main class” in my custom theme or in a plugin… could you show a short example?

    Huge thanks in advance!

  7. nicolas

    thank you very much for sharing this mini tutorial, I’ve been looking for it for hours and finally I found this, thanks really

  8. Mahabub

    nice tutorial thanks for share.

  9. Bharat Chowdary

    Thanks for this tip

  10. Gytis

    Interesting find, thanks for sharing. I was looking for that too! 🙂

2 pingbacks

  1. SwiftPSD.com Launches Fresh New Design, Still Premier Source for Webs Best … | Open Knowledge
  2. Linkhub – Woche 15-2012