I've made some researches on google but can't get the right answer.

I need to get my wordpress loops outside a domain using php file.

For example: I have a website hosted with www.mysite.com using wordpress. And an other one is www.secondwebsite.com using only php.

I would love to use something like the wp-load.php to use my loops in my php files.

Thanks a lot,


I can't get the server path rightly... Any ideas?

Here are my different path:



Folder where the wp-load.php is:


I tried this:

//Include WordPress
define('WP_USE_THEMES', false);


<?php while (have_posts()):
      the_post(); ?>
      <h2><?php the_title(); ?></h2>
      <?php the_excerpt(); ?>
      <p><a href="<?php the_permalink(); ?>">Read more...</a></p>
<?php endwhile; ?>

But not working. I think I can't go to the /home directory cuz of the FTP rights.

Thanks for the help


  • Nothing new. Can't get my answer anywhere. Anyone know how I can get custom_post_type outside wordpress, and other domain? Thanks a lot!
    – jhon
    Commented Mar 31, 2014 at 11:46
  • This isn't a forum, if you have new information, post it as a comment on a question or an answer, don't respond in a new answer unless the response IS the answer to your question. You can also edit your own question to add new information.
    – Tom J Nowell
    Commented Mar 31, 2014 at 16:03

2 Answers 2


You mean: <?php include "http://www.sample.com/wp-load.php";

This setting is disabled/not allowed by default in most web servers (php.ini) so you can not use the include to include the files from a remote address for security reasons.

If you still want to allow inclusion of remote files, the directive allow_url_include must be set toOn(or 1) inphp.ini`.

But again it is a bad practice, in a security-oriented point of view. Often it is generally disabled.

Alternative is to use the feed. Parse the feed of the WordPress installation and use the content from this part. A another alternative is the XMLRPC surface, but the feed is easy to use and have all content parts.

  • Tried, but not working ! And i think allow_url_include is bad for injections !
    – jhon
    Commented Mar 26, 2014 at 17:30
  • Right, very insecure. That was my point to hint to parse the feed, secure and fast, cashable.
    – bueltge
    Commented Mar 26, 2014 at 21:34

Another option is to use wordpress json api. As bueltge mentioned the rss feed is one way to get your content but json api couldbe better in this case :)

Option one is to use http://wordpress.org/plugins/json-api/ option two would be the jetpack json api.

Not the answer you're looking for? Browse other questions tagged or ask your own question.