I have installed a WP on website A and I want the last post's links in site B. I haven't in site B any WP and I want to get the link of last post from website A. so I can't use WP API like WP_Query and so on..

Is there possible I do this with remote connection to MuSql and get the last post link?

How do this?

2 Answers 2


Assuming each site is WP, they'll both have RSS feeds. You're better off just to fetch the RSS feed and get the latest post link from that.

WP even has some built in support RSS parsing!

 * An example of how to use fetch feed
 * @uses    fetch_feed
 * @return  bool|string False on failure, the permalink on success
function wpse60754_fetch_feed($feed_url)
    $feed = fetch_feed($feed_url);

        return false;

    $items = $feed->get_items(0, 1);

        return $items[0]->get_permalink();
        return false;

I think this is what you might be looking for.


Basically on the NON-WP site create a function that parses an RSS feed via file_get_contents() and SimpleXmlElement() combined to grab the titles.

Instead of a foreach loop though use do $x[0]->whatever like this:


function getFeed($feed_url) {  

    $content = file_get_contents($feed_url);  
    $x = new SimpleXmlElement($content);  

    $entry = $x[0]->channel->item

    echo "<a href='$entry->link' title='$entry->title'>" . $entry->title . "</a>";  


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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