wp-load Without Loading the plugins

You would need to put something like this in a .php file of any name in your must-use plugins folder (/wp-content/mu-plugins/) so that it loads before all plugins so you can use it to filter the plugin loading… <?php if (defined(‘SHORTINIT’) && SHORTINIT) { add_filter(‘option_active_plugins’, ‘shortinit_plugins_filter’); function shortinit_plugins_filter($plugins) { $noloadplugins = array(‘w3-total-cache’); foreach ($plugins as … Read more

Include user defined styles without including wp-load

If you are going to enqueue a stylesheet you should be using wp_enqueue_scripts not wp_print_styles, but you are in a bit of a gray zone between doing things “WordPress-ie” and doing things correctly for performance. The “WordPress-ie” way is to enqueue a stylesheet, but from a performance standpoint you are loading an additional resource and … Read more

Call to undefined function issue

Christ, once again I was fighting with something for a few days straight and found a solution 20 minutes after asking on StackExchange. WHY? require_once(‘../../../wp-load.php’);

How to avoid wp-load.php within a PHP/CSS file?

Here is a basic setup that I use for AJAX with WordPress. instead of loading wp-load.php; just use WordPress default method for AJAX calls. This allows you to also filter function calls from Javascript through a switch. I also added a quick example for wp_localize_script. <?php add_action(‘wp_enqueue_scripts’, ‘YOUR_NAME_scripts’); //back end function YOUR_NAME_scripts( $hook_suffix ) { … Read more

Get current user data from external PHP page

You can… Load the file into the file where you want to display the ‘hey username’ message: <?php include(TEMPLATEPATH .’/check-user-hello.php’); ?> . Then in that file “check-user-hello.php” You need to put this code <?php if ( is_user_logged_in() ) { global $current_user; get_currentuserinfo(); echo ‘Hey ‘ . $current_user->display_name; } else { echo ‘<a href=”‘. get_bloginfo(‘url’) .’/wp-admin” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)