Home › Forums › WordPress Plugins › html in subject line
- This topic has 3 replies, 2 voices, and was last updated 6 years ago by
vinny.
-
AuthorPosts
-
-
September 29, 2017 at 11:38 am #6216
Chris
ParticipantHi 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 . . . -
September 29, 2017 at 1:52 pm #6217
Chris
ParticipantHa — 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 “-“-
September 29, 2017 at 8:01 pm #6219
vinny
KeymasterIt 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!
-
-
September 29, 2017 at 4:50 pm #6218
vinny
KeymasterHi 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
-
-
AuthorPosts
- You must be logged in to reply to this topic.