wp-load not working (6 posts)

  1. theduke01
    Posted 4 years ago #


    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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <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?

  2. Helen Hou-Sandi
    WordPress Dev
    Posted 4 years ago #

    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);

  3. theduke01
    Posted 4 years ago #

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

  4. Helen Hou-Sandi
    WordPress Dev
    Posted 4 years ago #

    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.

  5. Helen Hou-Sandi
    WordPress Dev
    Posted 4 years ago #

    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.

  6. New Nine
    Posted 4 years ago #

    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:


Topic Closed

This topic has been closed to new replies.

About this Topic