I have an array which I populate like this:
array_push($comboUserPosts,
array(
'link'=> get_permalink(),
'dates'=> $value,
'title'=> get_the_title()
)
);
Then when I finish all my loop, I do:
array_unique($comboUserPosts);
But it still gives me duplicates. If I do:
echo '<pre>' . var_export($comboUserPosts, true) . '</pre>';
This is what I get:
array (
0 =>
array (
'link' => 'https://example.com/test/test-values-users/',
'dates' => '1920',
'title' => 'test values users',
),
1 =>
array (
'link' => 'https://example.com/test/test-values-users/',
'dates' => ' 1954',
'title' => 'test values users',
),
2 =>
array (
'link' => 'https://example.com/test/provo-filter/',
'dates' => '1600',
'title' => 'provo filter',
),
3 =>
array (
'link' => 'https://example.com/test/provo-filter/',
'dates' => '1450',
'title' => 'provo filter',
),
4 =>
array (
'link' => 'https://example.com/test/provo-filter/',
'dates' => '1330',
'title' => 'provo filter',
),
)
But by looking at that, I only have 2 unique links and title, I should only display those two links+title when I do:
foreach ($comboUserPosts as $value) { ?>
<h2><a href="<?php echo $value['link']; ?>"><?php echo $value['title']; ?></a>
<?php }