i have an error in my plugin in WordPress, it showed error on line 89 which is
if ( is_array( $related ) ) {
foreach ( $related as $value ) {
$words[] = $this->search_string( $value );
if ( isset( $this->settings[ 'tooltip' ] ) ) {
$links[] = $this->tooltip_html( $link, '$0', $post, $target, $nofollow, $internal );
} else {
$links[] = '<a href="' . $link . '"' . $target . $nofollow . '>$0</a>';
}
}
}
endwhile;
if ( !empty( $words ) ) {
if ( isset( $this->settings[ 'first_occurence' ] ) ) {
$text = preg_replace( $words, $links, $text, 1 );
} else {
$text = preg_replace( $words, $links, $text ); //line 89
}
}
wp_reset_postdata();
}
So when i reached there i saw that search_string() function is being called and immediately went there and found a string of symbols i applied the ~ fix but don't know if this works.
public function search_string( $title ) {
return '~/(?<!\w)((?i)~' . $title . '~(?-i))(?=[ \.\,\:\;\*\"\)\!\?\/\%\$\£\|\^\<\>])(?![^<]*(<\/a>|<\/span>|" \/>|>))/~';
} As you may see i have applied ~ before all single quote i wanna ask am i in the right way ?