Skip to content

Commit

Permalink
Fix: Removes a chance for empty links
Browse files Browse the repository at this point in the history
  • Loading branch information
msaari committed Oct 19, 2021
1 parent e0f9146 commit 3ff03c7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/common.php
Expand Up @@ -1035,7 +1035,10 @@ function relevanssi_permalink( $link, $link_post = null ) {
}
// Using property_exists() to avoid troubles from magic variables.
if ( is_object( $link_post ) && property_exists( $link_post, 'relevanssi_link' ) ) {
$link = $link_post->relevanssi_link;
// $link_post->relevanssi_link can still be false.
if ( ! empty( $link_post->relevanssi_link ) ) {
$link = $link_post->relevanssi_link;
}
}

if ( is_search() && is_object( $link_post ) && property_exists( $link_post, 'relevance_score' ) ) {
Expand Down

0 comments on commit 3ff03c7

Please sign in to comment.