Support » Fixing WordPress » Plugins disabled when using wp-blog-header.php for site integration?

  • Resolved Adam Brown


    I’m trying to pull the most recent posts from my blog into a different part of my site. That works fine. But it appears that none of the plugins that should be filtering the posts are running.

    Here’s the code I’m using to pull the posts:

    require_once( 'path-to-wp/wp-blog-header.php' );
    require_once( get_home_template() );

    (The problem persists even when I replace that last line with a custom loop, but for now I’m just using the normal template for troubleshooting.)

    If I precede that code with define('WP_USE_THEMES', true);, then the problem goes away–all the plugins run as expected. But then, I also lose the ability to create a custom loop.

    Is there some constant I need to set or function I need to call to get the plugins to run? They’re running on standard hooks (mostly “the_content”), so I can’t fathom why they don’t run here.

Viewing 1 replies (of 1 total)
  • The answer: Turns out some of my plugins don’t fully load up until the “template_redirect” action. They do this, apparently, to preserve server resources. The main plugin file only has a small function that, when called by the “template_redirect” action, loads up the rest of the plugin’s files.

    Presumably the plugins do this to keep from taking up server memory when, for example, you’re looking at admin screens.

    So just adding in do_action('template_redirect'); to the previous code solves the problem. Everything is firing on all cylinders now.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugins disabled when using wp-blog-header.php for site integration?’ is closed to new replies.