Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8435639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:58:07+00:00 2026-06-10T06:58:07+00:00

I have multiple branch sites that feed their RSS news feeds to one main

  • 0

I have multiple branch sites that feed their RSS news feeds to one main site using Simplepie. This works great. The only problem is, sometimes multiple branches post the same news article and that in turn displays multiples news articles on the main site. How would I go about removing the duplicates?

<?php
require_once(ABSPATH .'php/simplepie.inc');
$feed = new SimplePie();

$feed->set_feed_url(array(

'http://www.branch1.com/feed/',
    'http://www.branch2.com/feed/',
    'http://www.branch3.com/feed/',
    'http://www.branch4.com/feed/',

));

$feed->set_favicon_handler('handler_image.php');
$feed->init();
$feed->handle_content_type();


foreach ($feed->get_items() as $property):

    // I want this to be unique
    echo $property->get_title();

endforeach;
?>

I have already tried. With no luck.

foreach (array_unique($unique) as $property):

I also tried to do a second foreach looking for any matching titles. And only displaying the ones that are have the number 1 next to them or the first match… But It kept giving me the amount of matches instead of:

1.Match0
1.Match1 2.Match1 3.Match1
1.Match2 2.Match2
ect ect…

foreach ($feed->get_items() as $property):

 $t = $property->get_title();
 $match = 0;

foreach ($feed->get_items() as $property2): 
  $t2 = $property2->get_title();

  if ($t == $t2){
   $match++;
   //echo $match;
      }

    if ($match <= 2){echo "$match. $t <br/> ";}

    endforeach;

endforeach;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:58:08+00:00Added an answer on June 10, 2026 at 6:58 am

    Try putting the fetched items in another array with the key of the title so that duplicated titles will be overwritten in the array. Then you pull back the contents from the array.

    $arrFeedStack = array();
    foreach ($feed->get_items() as $property):
        $arrFeedStack[$property->get_title()] = $property->get_description();
    endforeach;
    
    foreach ($arrFeedStack as $item) {
        echo $item . <br />;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple commits in one branch. When I push these commits for code
I have one application that I sold to multiple clients. Each client has his
Previously, using SVN, I would have a branch that was my development branch, which
I have a feature/admin branch that is tracking multiple branches (origin/feature/admin and development, the
I have multiple UpdatePanels on a webpage, one inside UserControl (Purple ColorBox as show
I have multiple active branches that I need to work on at the same
At work, we have multiple branches that we may be working on at any
We have multiple developers working on a project. We're employing a feature-branch method of
Some Background: I am a single developer working on one site. I am using
We have multiple development branches and want to restrict commits to a particular branch

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.