[Resolved] Character Encoding Issue

Home Forums Support [Resolved] Character Encoding Issue

Home Forums Support Character Encoding Issue

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #962962
    Vish

    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 ‘1080×2340 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.

    #963075
    Tom
    Lead Developer
    Lead Developer

    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/

    #1244780
    Tom

    No question, just a solution.

    I had essentially the same question: how to disable the default WordPress behavior of replacing “5-25×56” 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' );

    #1245556
    Tom
    Lead Developer
    Lead Developer

    Thanks for posting your solution! 🙂

    #2356159
    Javier

    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?

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.