Site logo

Archived topic

Character Encoding Issue

4 replies · Started by Vish on July 20, 2019

Viewing posts 1–5 of 5

Hi Tom

I was trying to create a post today and came across a very strange issue.

I tried to give the title for the post as '1080x2340 Wallpapers'. Whenever I do that, WordPress automatically treats the lowercase 'x' as multiplication symbol '×' in the front end (when the post is published). If you look at them side by side (x×) they are not the same.

Because of this, the title of the post becomes '1080×2340 Wallpapers' (this title has the multiplication symbol) as opposed to '1080x2340 Wallpapers'.

Is there some way we can override this with some PHP code?

For example, whenever a multiplication symbol '×' comes in the title replace it with lower case 'x' with PHP?

Is it possible?

Note: I know this is nothing related to GP but I just wanted to see if it is possible to write a simple PHP function to achieve this.

Hi there,

I wasn't aware that WordPress did this by default. I just did some digging around for a function, but couldn't find one.

It might be worth asking over here: https://wordpress.stackexchange.com/

No question, just a solution.

I had essentially the same question: how to disable the default Wordpress behavior of replacing "5-25x56" with "5-25×56" (using multiplication symbol)? For more information about what wptexturize does, see: https://developer.wordpress.org/reference/functions/wptexturize/

Here's the solution that I used to entirely disable wptexturize:

* Install the Code Snippets plug-in (see: https://docs.generatepress.com/article/adding-php/). This approach was simpler for me than creating a child theme just to run a single line of PHP.

* Add a snippet with the following line of code (see: https://codex.wordpress.org/Plugin_API/Filter_Reference/run_wptexturize):

add_filter( 'run_wptexturize', '__return_false' );

Thanks for posting your solution! :)

Hi, this solution seems to work for the Spanish quotes too.

But it isn't working with a Page hero block element.

I added a Header with "Dynamic text type" set to "Title" and it still shows the title with Spanish quotes (« ») instead the normal (” ”).

Does anyone have a solution for this issue?

This archived topic is closed to new replies.