Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I made my own upload service for my website that is separate from WP, but uses WP to provide low level db functions and user verification. To do that, I include wp-load.php in my main script (Uploadify) but doing that seems to fill the server's memory with unnecessary components. Thanks to that, I'm seeing an error in my script that seems to point to a installed WP plugin.

How can I load only the core WP components and ignore plugins? Is this even possible?

share|improve this question
1  
Check out BackPress. –  soulseekah Apr 3 '12 at 18:28

3 Answers 3

Disabling plugins entirely means you loose many advantages.

There are distributions of wordpress that go further and rip out posts and links etc, but they'll always lag behind WordPress core and tend not to survive as long.

Here are some things that could be done

Short Init

Putting this in your wp-config.php:

define( 'SHORTINIT', TRUE );

Or defining it somewhere before you load in wordpress, should reduce the loading process and pull it back to minimal core functions.

Secondary lightweight installs

Setup a second wordpress installation, with only the plugins and themes you want (if any). Then configure the wp-config.php to use the same wp-content directory and database values.

Backpress

WordPress, the original BBpress and glotpress amongst others are built around the BackPress library. You could use this instead of WordPress to do your work though numerous APIs and features may be missing or in need of re-implementation/porting

Option tables

I would also bear in mind that WordPress loads the entire options table into memory to cut down on queries, if you're saving any large values in there it'll impact on performance.

Exiting early

You could also try hooking into earlier functions in the WordPress load process and exiting the PHP process before WordPress is finished, but I can't advise on how safe that would be.

Selectively loading plugins

There is also this article on selectively loading plugins, but it does require hacks to the wordpress core files

share|improve this answer
    
+1 Ever tried "Secondary lightweight installs"? –  kaiser Apr 5 '12 at 12:38
    
I've done similar things, though never for this purpose, most use cases would be better served by multisite. Mainly I use it so I can have a development install running alongside so they share content –  Tom J Nowell Apr 5 '12 at 13:06

Use BackPress, but i have small developments, where i use a default install and smaller source via const.

see on the wp-settings.php

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

Set the const SHORTINIT on true in the wp-config.php and see the fast run. define( 'SHORTINIT', TRUE );

These are the files you get:

// All are located in ABSPATH.WPINC
'/load.php'
'/default-constants.php'
'/version.php'
'/compat.php'
'/functions.php'
'/class-wp.php'
'/class-wp-error.php'
'/plugin.php'
'/default-filters.php'
'/pomo/mo.php'

// Only Multisite
'/ms-blogs.php'
'/ms-settings.php'
share|improve this answer

Have you tried define('SHORTINIT', true);? I haven't tested it myself, but it seems to load very few aspects of WP core while retaining enough functionality, especially if all you want is to deal with the database.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.