Skip to content

Commit 30f4b16

Browse files
hnccoxhnccox-yard
authored andcommitted
(feat): filter and sort portalUrls by numeric blogId
1 parent a7fef1d commit 30f4b16

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: src/Base/Models/PortalLinkGenerator.php

+10
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ private function getShowOnPortalURL(): string
6565
return '';
6666
}
6767

68+
// Filter out terms where slug is not numeric
69+
$terms = array_filter($terms, function($term) {
70+
return is_numeric($term->slug);
71+
});
72+
73+
// Sort terms by slug (blog ID)
74+
usort($terms, function($a, $b) {
75+
return intval($a->slug) <=> intval($b->slug);
76+
});
77+
6878
$portalURL = reset($terms);
6979

7080
if (isset($_GET['source'])) {

0 commit comments

Comments
 (0)