[wp-hackers] prevent theme's functions.php from loading in wp-settings
Paul Menard
paul at codehooligans.com
Sat May 3 23:19:29 UTC 2014
Greetings. I custom processing loop outside of WordPress. This is a custom
AJAX handler and depending on the POST arguments I do some stuff outside of
WordPress or as in this case I load WP via the following.
define( 'SHORTINIT', false );
define( 'WP_USE_THEMES', false );
define( 'WP_DEBUG', false );
// Load in WP core.
require( $configs_array['ABSPATH'] .'wp-load.php' );
So as anyone knows wp-load.php then calls wp-config.php which in turn calls
wp-settings.php
Within wp-settings.php line 324 begins the logic and my issue.
if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {
if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH .
'/functions.php' ) )
include( STYLESHEETPATH . '/functions.php' );
if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
include( TEMPLATEPATH . '/functions.php' );
}
Seems I had always thought setting the define 'WP_USER_THEME' as false
would prevent the theme from loading. I guess I was wrong.
What I'm really trying to prevent is a query used within the TwentyFourteen
theme in twentyfourteen/inc/featured-content.php where registers an action
for when 'wp_load' action hits. This in turn causes a get_option call for
featured content in line 471 Not that this is a big query.
$saved = (array) get_option( 'featured-content' );
Just bugs me that I can't stop it from being called.
More information about the wp-hackers
mailing list