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!
<?php
/**
* 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);
if(is_wp_error($feed))
return false;
$items = $feed->get_items(0, 1);
if(count($items))
return $items[0]->get_permalink();
else
return false;
}
Related Posts:
- Query All users that has post
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- Queries take 120+ seconds on my large WordPress site
- Return records between two meta datetimes saved as strings
- Query to fetch custom taxonomy along with post title
- Search & Remove Specific Shortcode From All Posts
- Using $wpdb to query posts with meta value containing current post_id
- Query posts from current year
- How to add posts to wp_query result?
- Order post by year DESC and month ASC
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- How can I display a specific user’s first published post?
- wp_enqueue_media() slows down my WP site
- How can I get all posts data from within a paginated search result?
- Query posts from different categories in multisite
- posts_per_page doesnt work
- Sorting posts according to view counts not working
- Only display posts after current date
- Reset/Reorder posts ID in the MySQL wp_posts table
- Improving WP_Query for performance when random posts are ordered
- Get posts by name and taxonomy term
- WP_Query Authors OR Categories
- Get Posts that are in the current month or later
- do_shortcode within post query
- Get Meta Key Value While Saving Post
- Most liked page not displaying posts
- Query get post,how to add comment box
- Get user categories with most posts in it
- MySql query to get posts with all meta and terms
- get query() without post content?
- How can I setup a relationship using categories in WordPress?
- Custom order for Mysql array
- posts_per_page option limits the number of Gallery items
- List authors with the last post title and order by last post date
- How i can limit period of post publication?
- How to Mysql select a list of posts with meta_values AND all relevant categories?
- How to setup a query to output posts by groups of five?
- What do these phpMyAdmin errors mean on my WordPress databaes?
- Exclude current custom post on single post
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- Dynamically switch template on click
- Get all custom post types excepted some…
- Get all comments of author’s posts
- First x post with another template then the others
- Why Query is returning empty array?
- Delete all drafts?
- Wrap every month posts in div
- meta_value timestamp older than now
- Do not show children of a category
- post__in not working with pre_get_posts, but post__not_in does work
- Query for first 3 posts to change the look and feel
- Query posts and filter at query time by value of custom meta
- Very complex post query
- Delete post revisions only for a single post
- How to give classname to post if post has no content?
- Display post by click on the link
- Database hacked – random posts are modified
- How to retrieve certain number of images from a wordpress post?
- Restore woocommerce orders
- How do post IDs work in WordPress?
- Some doubts about how the loop work (trying debugging it)
- Get author posts count after excluding a category
- How to display only one category in a custom post type?
- Anyone know a php snippet for showing the first 200 characters of the most recent post?
- Get current taxonomy and display query accordingly
- How Can I Always Display A Particular Post First Using WP_Query?
- MySQL: Possible to replace all of wp_posts.post_content(id#) via UPDATE + REPLACE + SELECT?
- Deleting post tags removes categories
- Check if almost 10 year old – working code is up to date
- MYSQL: Create SQL query to search for string and replace
- How to fetch courses in all languages in WordPress?
- Query custom post type custom meta key
- Mysql update menu_order problem
- Bulk find & replace on WordPress posts/pages (minus image paths)
- ‘posts’ table should not store the absolute image path
- load post data into mysql
- filter posts based on menu_order
- Count posts for pagination
- Show 5 posts and than 3 posts offset with pagination
- I need some explanation on global $post [duplicate]
- How to delete all posts with dead image urls?
- Querying posts from current category, using a variable as array argument
- Query posts from newest category
- wp query custom orderby not custom field
- Query post by meta key of another table
- Query post category & remove any post id
- Converting Posts to Pages
- Ordering posts alphabetically by meta keys and title
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How to change the publishing date of each posts?
- Grab next post title in archive page
- Continuous listing from a custom field
- How to store post rating system data post independent?
- How to limit post query to only return a total count of items with certain post statuses?
- If meta_key exists then don’t select this post?
- query_post or single-[cpt].php?
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields
- Display posts with id equal to relationship value
- Sort Posts Alphabetically Based on Specific Category (Divi)
- Change permalinks in posts via SQL