WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to display a list of posts (custom post types) coming from a different WordPress installation (to make things more clear, my client wants has two separate sites, and they want to list their listings on both sites, but only add them once).

I have tried to implement this with PHP/MySQL and I am able to grab the post title, content, ID and date from specific custom post type, however all the added fields are stored in *wp_postmeta* under the field '*meta_key*', so as you can imagine this will be nightmare to sort out.

I was hoping someone has a quicker and easier solution to displaying full date of any given post on a different WordPress installation.

share|improve this question
Are you trying to load JUST the custom post type, or are you trying to have 2 sites that share all their post data? – mor7ifer Jan 11 '12 at 3:14

The simplest way to get post from WordPress to WordPress is to use RSS. You can use SimplePie to work with the feeds on your destination site. http://simplepie.org/wiki/reference/start

I used this technique to get posts from WordPress to Joomla CMS and I never looked back.

Edit Added

I have used feeds for this in the past and it works very well, and SimplePie is comes with WordPress, you just have to add the proper class. I used this method to get the latest posts into a Joomla site and it worked flawlessly.

To get to your feed URL in code checkout get_category_feed_link or the_category_rss() (Note: the_category_rss() must be in the loop)

This is how you get a feed from anywhere into WordPress You might want to break it down to use filters and actions but this is the basic idea and will work just fine if you just drop the files into your template file.


require_once  (ABSPATH . WPINC . '/class-feed.php');

$feed_url = 'feed://techcrunch.com/feed/';
$feed = new SimplePie($feed_url);


Display code

<h1>Latest 5 Post<?php print $feed->get_title(); ?></h1>
<?php foreach ($feed->get_items(0, 5) as $item): ?>
        <a href="<?php print $item->get_permalink(); ?>">
        <?php print $item->get_title(); ?></a>
<?php endforeach; ?>

<h1>Latest post from <?php print $feed->get_title(); ?></h1>
<?php $item = $feed->get_item() ?>
<h2><?php print $item->get_title(); ?></h2>
<?php print $item->get_description(); ?>

Command for getting feed URL from source WordPress site ( runs anywhere )

$url = get_category_feed_link('25', ''); // get your category id
$feed = SimplePie($url);

Possibly helpful links

Simple Pie Sample Page : http://simplepie.org/wiki/setup/sample_page

WordPress get_category_feed_link() : http://codex.wordpress.org/Function_Reference/get_category_feed_link

Some nice SimplePie code samples you can start with: http://www.corvidworks.com/articles/easy-feed-reading-with-simplepie

share|improve this answer
does this still work? @Nickiler – Bryan Barrera Sep 15 '14 at 14:12

I think another simple solution, would be for you to create a JSON file via PHP of all the content you need (including any additional meta), i.e.


// Delcare JSON filetype

header( 'Content-Type:application/json' );

// Grab wp-load & $wpdb

include '../../../../../wp-load.php'; // wherever it is

global $wpdb;

// Run your Custom Loop whilst saving to $array


// Encode & echo the JSON

echo json_encode( $array );


At that point you can just grab the file contents from this PHP file and run a simple loop through it all. You can also take advantage of the Transient API to help store your data on the other site if it's high traffic.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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