Why does HTML entities are still encoded in Code Block?

In the Code Block if I type in reversed character, they are encoded to HTML entities: Input: Output: <pre class="wp-block-code"><code>'[] </code></pre> Meanwhile, if I put them in the custom HTML block, the output characters aren't encode: Input: Output: <code>'[]</code> <code class="'[]"></code> <code><code class="'[]"></code></code> <pre class="wp-block-code"><code>'[]</code></pre> I wonder why this should be the case? I enable troubleshooting mode and use the Twenty Twenty-One theme. Related: Why does the custom HTML block not preserve the HTML characters?
Category: Web

Why does the custom HTML block not preserve the HTML characters?

For example it seems that the plain single-quote character ' (') is converted to the right ones ’ (’) in the HTML page output. I understand the reason for this in regular Gutenberg blocks, but why does it still need to be done in the custom HTML block? I enable troubleshooting mode and use the Twenty Twenty-One theme and it's still converting. Here are the different between the input methods: <p>Paragraph block then converted to html: ‘</p> Custom HTML block: …
Category: Web

Wordpress 4 invalid username special charachters issue

I have some danish users that uses special chars like æøå and they can't log in to my wordpress blog. I tried on a fresh install on 4.2.2 and on 4.1.5 and it did not work, for example Andrew Schønnemann with a simple password and it did not work, got message ERROR: Invalid username. Lost your password?. But with user Andrew Schonnemann works fine, what could be the issue?
Category: Web

How Can I Use Equal And Question Mark In Category Slug?

I need to add a question mark and equal the category url. I need this: site.com/stack?exchange=ask But Wordpress does not allow specific characters in url. So i tried to use html encodes in category slug. Like as site.com/stack%3Fexchange%3Dask Thus, the url shown with html encodes and this category does not list the products. How can i use "?" and "=" in the category slug? Regards
Category: Web

Why is Wordpress swapping double quotes (") to curly quotes (“) and how do I stop it from happening?

I have imported HTML into a Wordpress page, it contains some HTML as follows: <a class="fancybox" href="bigger-image-path.jpg" title="<em>This is the image caption,</em> by someone"> <picture> <source media="(min-width: 768px)" srcset="/image-path.jpg 1x, /image-path.jpg 2x"/> <img class="image-no-border" style="width:100%; height:auto" src="/image-path.jpg" alt="alt"> </picture> </a> When I look at this HTML once it is imported via phpmyadmin, the HTML all looks correct as it is above. But when I look at the page source, the HTML has been changed somehow to the following: <a class="fancybox" …
Category: Web

How can I stop wp_update_post messing up HTML example code?

I'm showing little pieces of example HTML/PHP code on the frontend (with syntax highlighting). The entries are displayed as FAQ custom posts, and have a plugin (CMS Tree page) to alter the menu order, at which these are displayed. Whenever I change the order, it calls a wp_update_post, updating ID, menu_order, post_parent, post_type. For debug, I output the post_content property right before updating, and right after, and it gets changed in a horrible way. Before (correct): [html light="true"]</body>[/html] After (messy): …
Category: Web

HTML Entities displaying improperly as malformed escaped code

I'm having a strange issue that I've never seen before. I moved a WordPress site from Siteground over to GoDaddy a few days ago, and now the site appears to have problems displaying HTML entities in certain cases. For example, on the 404 page, the title prints to the source code as: <h1 class="page-title">Oops! That page can’t be found.</h1> Causing it to display on the page as "Oops! That page can’t be found." As you can see, for some reason …
Category: Web

wp_query not searching with apostrophe

I'm trying to search WP_Query for the data containing the phrase "Dalton's Law" in meta_query. This is an AJAX search, and here's what I"m doing: //in this case $_POST['query'] is the phrase "Dalton's Law" $query = apply_filters( 'get_search_query', $_POST['query'] ); $query = esc_html( $query ); $guide_meta_args = array( 'post_type' => array( 'guide' ), 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'posts_per_page' => 4, 'meta_query' => array( array( 'key' => 'guide_raw_data', 'value' => $query, 'compare' => 'LIKE', ), ) ); I will …
Category: Web

The "\" is missing when comments is updated

When I update the comment in the following page, the “\” is missing. I find that the problem is due to the plugin buddypress. How to avoid the wordpress comment editor converting characters like “\” to html? There is no problem when I post a new comment or edit a post. It happens only when I edit and update the existed comments.
Category: Web

Rewrite URL for Search + Special Characters / Umlaute

I want prettier search urls, like /suche/Danach+suche+ich/ So here is my code: add_filter("rewrite_rules_array", function($rules) { $newRules = array(); $newRules["suche/(.+)/?$"] = 'index.php?s=$matches[1]'; $merged = array_merge($newRules, $rules); return $merged; }); /?s=Testbeitrag works /suche/Testbeitrag same result, nice /?s=Ümlautetest works, nice! /suche/Ümlautetest doesn't work I still get to the right page, but there are no posts printed out– . EDIT: it appears that the issue is in my archive.php I want to change the number of posts for all queries going to archive.php in …
Category: Web

Why does the usermeta table contain html entities?

As a plugin developer, I have been storing special characters like ampersand as is in MySQL tables, then converting them to html entities after retrieving them for display. Now I discover that (for example) wp_insert_user() converts them to entities before storing them in the database. Have I been doing this the wrong way round? Should I convert before storing and then not convert when retrieving? Has Wordpress Core adopted any convention for this? What do other plugin developers do?
Category: Web

Wordpress special characters coming in ascii code

The article title on this website is "Meet Youngest Art Director of Pakistan – Babrus Khan" The special character in the title is not encoded back when retrieved from Database and Hence I can see in Html code, the title is "Meet Youngest Art Director of Pakistan – Babrus Khan" When shared on Social Media the ASCII codes appear rather than the special characters. How can I solve this problem?
Category: Web

How do I stop HTML entities in a custom meta box from being un-htmlentitied?

I have a custom meta box that is supposed to accept HTML, but the text I'm trying to input contains both double and single quotes (and ampersands), and it's messing up the saved data - each time I reload the post, the data is duplicated with an extra single quote (and angle bracket) inserted at the end. I'm guessing its trying to "close" what it thinks is an unclosed phrase in single quotes, when really its an apostrophe. I can …
Category: Web

How do we remove mystical [X] from text? Image included

Wordpress has placed an uncalled for character on one of our page's text. We have a few hundred pages, and this only occurs on one. In the paragraph's text, between the words 'Music' and 'Students', WordPress has placed a [X] character. It is not in the visual or text views, and only appears on the actual page. It cannot be copied nor is there an extra space in the code. In essence there is no extra character between the two …
Category: Web

Codex Function Problems When There is an Apostrophe in the Category Name

I'm working on a site, largely managed by categories. Two of the categories have apostrophes in them... ex. "Joe's Place" and "Tina's Lounge". (Actual titles changed, these are examples...) The category slugs are "joes-place" and "tinas-lounge". The customer asked for a breadcrumb on the site... Unfortunately the breadcrumb call fails whenever the category has an apostrophe in its name. The failure occurs at the call to get_cat_ID. Oh, and when the breadcrumb fails, the whole page fails. Here is a …
Category: Web

Why is `--` converted into ndash and how can I get rid of it?

I have a blog where I publish Linux tutorials. Some of the commands I listed have a -- before command-line arguments. e.g.: dpkg --get-selections. The problem is that WordPress automatically switches -- to an – (–). I know I could use the −− HTML entities, but the display is slightly different than the keyboard - sign. What I want is to disable this behaviour of WP. Is there a way to solve this?
Category: Web

Special characters in WordPress UTF-8

I have a problem regarding special characters that are appearing messed up on the front-end . mainly the get converted to question marks, or something like �?) Example - Frédèric becomes Fr�d�ric. some facts that made me puzzled: This WP install is on LOCAL machine, and shares the server with at least 40 other installs - none of which have this problem. This WP install shares also the same DB as the others . My wp-config file has the collate …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.