Support » Fixing WordPress » wp-load not working

  • Hi,

    I am trying to load wordpress content from my site into an external web page, without success. I am using the following code:

    // Include WordPress
    define('WP_USE_THEMES', false);
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; />
    <title>Untitled Document</title>
    <?php while (have_posts()): the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <p><a href="<?php the_permalink(); ?>">Read more...</a></p>
    <?php endwhile; ?>

    link to the page on my server:

    any ideas where i’m going wrong?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Is it possible for you to turn on error reporting so you can see what’s going wrong? My guess is that require() does not want to take a full URL. Try using a relative local path instead, e.g. require('../wordpress/wp-load.php);

    can you advise how i turn on error reporting? – relative path doesn’t seem to be working either

    Sure, in your wp-config.php file, add the line define('WP_DEBUG', true);. If you already have one that defines WP_DEBUG as false, just edit that line instead. Be sure this line comes above where it says to stop editing and happy blogging (something along those lines). This should turn on error reporting and will give you more information about what’s going wrong.

    ACTUALLY, I just remembered you’re doing something outside of WordPress. If this doesn’t work, try error_reporting(E_ALL); at the top of your custom file instead. There are some other methods of turning on error reporting globally, so if those don’t work, there are some other options.

    The require function needs a relative path on your server. In your case, it looks like WordPress is installed in a subfolder (wordpress) of your main document root. Try this:


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp-load not working’ is closed to new replies.