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 Mar 31 '14 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 Mar 31 '14 at 16:03

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 Mar 26 '14 at 17:30
  • Right, very insecure. That was my point to hint to parse the feed, secure and fast, cashable. – bueltge Mar 26 '14 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.

protected by Community Apr 16 '14 at 20:58

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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