Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_strip_all_tags [ WordPress Function ]

wp_strip_all_tags ( $string, $remove_breaks = false )
Parameters:
  • (string) $string String containing HTML tags
  • (bool) $remove_breaks optional Whether to remove left over line breaks and white space chars
Returns:
  • (string) The processed string.
Defined at:



Properly strip all HTML tags including script and style

Source


<?php
function wp_strip_all_tags($string$remove_breaks false) {
    
$string preg_replace'@<(script|style)[^>]*?>.*?</\\1>@si'''$string );
    
$string strip_tags($string);

    if ( 
$remove_breaks )
        
$string preg_replace('/[\r\n\t ]+/'' '$string);

    return 
trim$string );
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics