Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#42928 closed defect (bug) (invalid)

Formatting function wp_specialchars_decode doesn't work

Reported by: italooko's profile italooko Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.1
Component: Formatting Keywords:
Focuses: Cc:


This in functions.php doesn't work, the string returns non-decoded quotes like &#8220, for example.

function get_title(){
   $title = wp_specialchars_decode(get_the_title(), ENT_QUOTES);
   $caracteres = strlen($title);
   $max = 73;
if ($caracteres <= $max){
    return $title;
else {
    $title = substr($title, 0, $max);
    $title = $title.'...';
    return $title;      }

Change History (1)

#1 @dd32
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hi @italooko and welcome to Trac.

wp_specialchars_decode() working as described is correct.

As the documentation reads:

Converts a number of HTML entities into their special characters.
Specifically deals with: &, <, >, ", and ‘.

If you want the behaviour of the PHP function html_entity_decode() call it directly.

Note: See TracTickets for help on using tickets.