Skip to content

Instantly share code, notes, and snippets.

@thierrypigot
Created December 19, 2022 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thierrypigot/6d75d145db1945d0d2ed0750d4717516 to your computer and use it in GitHub Desktop.
Save thierrypigot/6d75d145db1945d0d2ed0750d4717516 to your computer and use it in GitHub Desktop.
Ajouter ou modifier des éléments dans le code HTML généré par WordPress
<?php
function ajout_attribut_lien($text) {
$text = preg_replace('/(&lt;a.*?)(&gt;)/','$1 target="_blank"$2',$text);
return $text;
}
add_filter('the_content','ajout_attribut_lien');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment