Simmons Consulting, the Website of Toby Simmons

Apostrophe in title causes IE script error in WordPress admin


If you go to your admin panel and click on Manage, you might notice that occasionally Internet Explorer throws a script error.

The error will likely be:

Error:Expected ')'

The script that throws the error is the confirmation dialog box that WordPress creates for when you click to delete a post or page entry. The script runs a javascript function called deleteSomething(). One of the parameters passed to this function is the title of the post or page. If the title of your item has an apostrophe in it, when the title is passed to the function as a quoted string, the apostrophe would terminate the string early resulting in a script error. Thankfully, WordPress converts any apostrophes in the title to the numeric HTML entity '. This works great in Firefox.

Unfortunately, IE still sees it as a single quote mark and throws a script error.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>