If you write plugins, or use a plugin like RunPHP, or make advanced custom templates, you may eventually find yourself dealing with data in the database. WordPress usually manages this data for you in such a way that it is immediately usable. There are circumstances though (especially if you are dealing directly with the database without using WordPress) where you will experience weirdness.

For example, quote marks cannot be stored directly in the MySQL database. MySQL uses quote marks in its SQL language. When a quote mark is used, for example, in a post, When the post is saved to the database, every quote mark gets escaped. That means a backslash character is prepended, which signifies that the next character should be taken as part of the input, and not as part of the SQL command.

For example, if you are adding the following in your post:

...an article about "Happiness" is at 
<a href="http://example.com/happy" title="Happiness">Happiness</a>
if you would like to read it...

Is actually imported into the database looking like this:

...an article about \"Happiness\" is at 
<a href=\"http://example.com/happy\" title=\"Happiness\">Happiness</a>
if you would like to read it...

When pulling data out of the database, the backslashes may not always be automatically removed. If this becomes an issue, you can use the stripslashes() PHP function on the text.

Posted in: WordPress

Related FAQ's

Marius Ion ANGEL HOT SOFT LLC (800) 316-7677