Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_targeted_link_rel ›

Da5.1.0
Deprecaton/a
wp_targeted_link_rel ( $text )
Parametri:
  • (string) $text Content that may contain HTML A elements.
    Richiesto:
Ritorna:
  • (string) Converted content.
Definito a:
Codex:

Adds rel noreferrer and noopener to all HTML A elements that have a target.



Sorgenti

function wp_targeted_link_rel( $text ) {
	// Don't run (more expensive) regex if no links with targets.
	if ( stripos( $text, 'target' ) !== false && stripos( $text, '<a ' ) !== false ) {
		$text = preg_replace_callback( '|<a\s([^>]*target\s*=[^>]*)>|i', 'wp_targeted_link_rel_callback', $text );
	}

	return $text;
}