get_the_content() and emojis
-
I have a post with an emoji in it. I want to be able to access it programmatically to convert it to HTML Entities. IE change
?? to & # 129380;
If you view text of the post you’ll see:
??
$contentString = apply_filters( ‘the_content’, get_the_content() );
I examine the $contentString and see ` but looking at the text after < code > tag in a text file I saved, it shows that something is hidden there. Probably an encoding issue.
How can I access the emoji after < code > tag and convert it to its HTML Entity?
I tried a regex search with unicode to no avail.
$pattern = '/< code >(\X+)<\\\/code>'; $result = preg_match($pattern, $contentString, $matches);
Thanks in advance!
- This topic was modified 4 years, 1 month ago by .
- This topic was modified 4 years, 1 month ago by .
- This topic was modified 4 years, 1 month ago by .
- This topic was modified 4 years, 1 month ago by .
- This topic was modified 4 years, 1 month ago by .
- This topic was modified 4 years, 1 month ago by .
- This topic was modified 4 years, 1 month ago by .
- This topic was modified 4 years, 1 month ago by .
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘get_the_content() and emojis’ is closed to new replies.