Home Forums WordPress Plugins html in subject line

Viewing 2 reply threads
  • Author
    Posts
    • #6216
      Chris
      Participant

      Hi Vinny –
      Very much appreciate the update that decodes quotes in the subject line . . .
      Wondering if it’s possible to decode other html that shows up there?
      We had – show up there today . . .

    • #6217
      Chris
      Participant

      Ha — your forum ‘corrected’ my “-” . . . .
      If my post is confusing, I had attempted to let you know that our subject line contained: & # 8 2 1 1 ; — (minus the spaces) instead of “-“

      • #6219
        vinny
        Keymaster

        It didn’t really correct it, rather it took it at face value and the browser converted it into the character. You’ll still see the entity if you look at the source code.

        The trick to get entities to show as their code, is to convert the & into its own entity and type out the rest regularly. &’s entity is &, so you’d want to write &8211;

        Cheers!

    • #6218
      vinny
      Keymaster

      Hi Chris,

      You can add the following hook to your functions.php file:

      
      function chris_decode_entities( $email_subject, $type, $post_id )
      {
      	$email_subject = html_entity_decode( $email_subject );
      	
      	return $email_subject;
      }
      add_filter('bbpnns_filter_email_subject_in_build', 'chris_decode_entities', 10, 3 );
      

      That will handle all HTML entities. Make sure you have UTF-8 for subject enabled in case some entities turn out to be UTF-8 wide characters.

      Cheers,
      Vinny

Viewing 2 reply threads
  • You must be logged in to reply to this topic.