-
Posts
-
Hi There,
I am having an issue on WordPress :
When I want to set up a badge on wordpress, I have this message that appear : Special character must be escaped : [<]I have tried to add some spaces but nothing…
I hope you will be able to help me. Thank you 🙂 Ann-Lyz
The code is the following :<img style=”filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
src=”http://img.hellocoton.fr/fr/badges/badge-03-125×70.png”, sizingMethod=”scale”);” src=”http://img.hellocoton.fr/fr/badges/badge-03-125×70.png” alt=”Suivez-moi sur Hellocoton” border=”0″ />The blog I need help with is: (visible only to logged in users)
Hey annlyzsagou,
You’re using the standalone WordPress version (.org) and your website is hosted on Siteground.
We’re only able to help with the WordPress.com website.
Please contact your web hosting customer service or you can use the WordPress.org forums.
https://wordpress.org/support/forums/
- The topic ‘WordPress code error – Special character must be escaped : [’ is closed to new replies.
-
Hello,
I am trying to add the following code to the header, but I’m getting the message “special characters must be escaped”. Please could you kindly advise how to get around the issue? Thank you very much in advance.
<?php
$schema = get_post_meta(get_the_ID(), ‘schema’, true);
if(!empty($schema)) {
echo $schema;
}
?>
Viewing 3 replies — 1 through 3 (of 3 total)
-
Hi @hw37,
Thanks for writing in, and we’re sorry to hear about the trouble you’re facing.
Were you able to add the code into the plugin, or still facing the issue with the special characters?
@jainnidhi
I am having this problem.
When I try to add <meta http-equiv=”content-language” content=”en-us”> to the header, it says the < and > are special characters must be escaped. But when I do that, it puts it all in quotes.
Hi,
Did anyone get a solution to this? I have added this code using this plugin:
/* Scroll to anchor */ function pgshow(e){ var elId = window.location.hash; if (elId.length > 1){ el = document.getElementById(elId.substr(1)); if (el) el.scrollIntoView(true); } } // pageshow fires after load and on Back/Forward window.addEventListener('pageshow', pgshow);But I get the “Special Character Must Be Escaped : [ > ].” error.
I have tried various option found online but cannot seem to resolve this.
Viewing 3 replies — 1 through 3 (of 3 total)
- The topic ‘Special characters must be escaped?’ is closed to new replies.
Hi everyone,
since the last update, all my php files have this error every time I use theses characters «<» and «>».
Error on line 1 : <?php
or still on : echo "<p>Hello !</p>";
It is really annoying because I have a very high number of errors in my files and the linter is more binding than helpful… (example : a file with 340 lines have 141 issues…).
Before the last update, everything worked well.
Can you correct this please ? Thanks.
PS : I’ve created an issue on the linter github of atom community and they presumed this bug is in linter-php : steelbrain/linter#973 (comment)
@eved42 I’m pretty sure this is actually an issue with linter-htmlhint (See AtomLinter/linter-htmlhint#4), or even more specifically, with htmlhint itself. linter-php only runs php -l on the file, and it’s impossible for it to give an error message like that as it only checks for PHP syntax errors.
It looks like nobody actually filed an issue on that over in the HTMLHint repo, you might try that and see what they say.
Ok thank you for your answer. This morning, it seems to work again…
ive seen this problem on few forums and theres a very simple way to get rid of it, open dreamweaver Go to Edit — preferences, in left panel highlight linting, then in edit rule set
highlight html, click edit and apply changes, scroll down to where it says
«spec-char-escape»: true, and change it to false, edit your page click save and
you will see no more errors

Getting problem in including php file in html file.
Error — Special char must be escaped out.
please help me out in solving this problem.
This is a bug in htmlhint, nothing to do with linter-php.
Please follow this issue for when it will be resolved: htmlhint/HTMLHint#165
Until then unfortunately you’ll simply have to ignore it.
AtomLinter
locked as off-topic and limited conversation to collaborators
Apr 9, 2019
Edited to add: I am creating a button that links to an external URL. I don’t want the plain gray default button and have put some style code.
I am able to test this code and it seems to work just fine until I put it in WordPress where I need it. Then I get an error message that «special characters must be escaped» and that the a tag must be paired. What am I missing here? Thank you!
<p><a href="URL"rel="noopener noreferrer"target="_blank"><strong><button class="button">Join Group</button></strong></a></p>
asked Dec 22, 2020 at 17:02
LydiaLydia
11 bronze badge
4
On your span style you’re missing the quotation marks.
<p>
<a href="URL"rel="noopener noreferrer" target="_blank">
<strong>
<span style="button button1">
<button class="button button1">Join Group</button>
</span>
</strong>
</a>
</p>
answered Dec 22, 2020 at 17:08
ArianneArianne
5072 silver badges7 bronze badges
I know it’s best practise to escape all output. However I run into issues when people use special characters in their content. e.g. &, –, etc.
Note I’m using Timber, so for example if a post title uses an & in the text, and I echo and escape the title as follows:
{{ post.title|e() }}
(Not using Twig this would be<?php echo esc_html($post->title); ?>)
The page displays the htmlentity code (i.e. &) and it is not converted to an ampersand in the browser. However if I echo without escaping it displays correctly.
I thought perhaps Timber or Twig or WordPress were auto-escaping, and perhaps my content was double escaped, but if I add a script to the title to test the output e.g. "<script>alert('hello');</script>" This script will run if I don’t escape.
My question is how can I keep output safe but still render special characters in the browser that the user would expect to see from their content? And isn’t this how it should be working by default (i.e. browser rendering escaped ampersand correctly)?
Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
I am using brackets and had a pink box stating there was an error. I copied the code into dreamweaver as I couldnt find the problem and dreamweaver gave me this «special character must be escaped» here is the code
<a href="img/Accolade1a.JPG"> <img src="img/Accolade1a.JPG" alt""> <p>Accolade1a Template</p> </a>
I have this code placed several times with different images for each one, pretty basic code.
Any ideas?
Jim
5 Answers
Tom Lawrence July 21, 2015 11:32am
the error is your alt, it should be alt = «something»
Steve Hunter July 21, 2015 11:55am
I agree — you’re missing an equals sign between the alt and the empty string’s double quotes.
Should be:
<a href="img/Accolade1a.JPG"> <img src="img/Accolade1a.JPG" alt=""> <p>Accolade1a Template</p> </a>
Hope that helps.
Steve.
Tom Lawrence July 21, 2015 12:00pm
Dont slap yourself for forgetting the =, we all do that time and again. Instead slap yourself for not filling out the alt tag fully with a meaningful alt to help with accessibility 😛
well… actually that was done on purpose as the images are placeholders only for now while I mock up the site.
Tom Lawrence July 21, 2015 12:27pm