WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to include WordPress 3.0 code into the 3rd party scripts? (5 posts)

  1. CrazySerb
    Member
    Posted 3 years ago #

    Hey guys, I am having troubles with including WordPress code into 3rd party scripts... at least for the version 3.0. Everything worked fine and peachy with this code for v2.9.2:

    define('WP_USE_THEMES', false);
    require("/home/domain/public_html/wp-blog-header.php");

    But in 3.0.1 something changed and that same code, when added to a 3rd party script now, breaks it in a way that it doesn't wrap their code into WP one anymore, but it either opens up a /3rd-party-script-folder/wp-admin/install.php or it doesn't even open up the file requested in /3rd-party-script-folder and returns a 404 error.

    What changed to cause this?

    I mean, this might still work just fine for simple implementations without much authentication/cookies/session variable programming, but this 3rd party script developers team hasn't been able to figure out what's wrong and their only answer after a week straight of looking at it is to ask around here...

  2. NickHardeman
    Member
    Posted 3 years ago #

    I am having this same issue. Any solutions out there?

  3. James Revillini
    Member
    Posted 3 years ago #

    Ditto. I saw a suggestion to load wp-load.php instead, but it's not working for me so far. A query that pulls all child attachments to a post that works with wp-blog-header.php does not work when the other is loaded.

  4. James Revillini
    Member
    Posted 3 years ago #

    BTW, why is this marked resolved? There may be an answer out there somewhere, but it's not here.

    As a workaround, you can issue a 200 header manually in your script. it's a dumb way to so it but will get you over the hump.

    The wordpress way is

    status_header( 200 );

  5. NickHardeman
    Member
    Posted 3 years ago #

    Im just printing out .xml via a php script, but this worked for me. Not sure if it will help with more complicated issues.

    define('WP_USE_THEMES', false);
    require('../../../../wp-config.php');
    
    // output some xml //
    
    // now send the headers //
    $xml_string = $doc->saveXML();
    
    header('Content-Type: text/xml');
    header('Cache-Control: no-store');
    header("Content-length: " . strlen(utf8_decode($xml_string)));

Topic Closed

This topic has been closed to new replies.

About this Topic