Wordpress generating backslashes when apostrophe is used

Hey peeps.
Ive done some searching on this and everything i found applied to versions prior to 3.0.
i tried their advice anyway and couldnt get it to work.

anyone know why its doing this? i am using this theme on several other sites and not experiencing this problem.

the site is homeimprovementsporthuron.com/wp

the theme is elitepro theme by inkthemes (its a paid theme)

Are all these sites hosted on the same server?

It sounds like a “magic quotes” problem.

yes, all the domains on on the same server.

I don’t think it’s a magic quotes issue. Wordpress handles situations where magic_quotes_gpc is on or off. In fact, Wordpress strips any slashes that magic_quotes_gpc puts on $_POST or $_GET data and then [URL=“http://codex.wordpress.org/Function_Reference/add_magic_quotes”]re-adds slashes itself. Wordpress expects data to be escaped.

You could test to see if magic_quotes_gpc is on by placing this in your footer.php file just ahead of the closing </body> tag:


<?php
if (get_magic_quotes_gpc())
{
   echo '<p>Magic Quotes is on.</p>';
}
else
{
   echo '<p>Magic Quotes is off.</p>';
}
?>

Can you take a look at the post text in the database using phpMyAdmin or something? If you see slashes when viewing the post content, that is an indication that something is being double escaped somewhere. Are you using any plugins or applying any filters to content before it is being place into the database or being displayed, or are you manually escaping anything?

Tried the php code. slashes still there, so im guessing its not magic_quotes.

heres what im finding: in the page text, the word you’ll is displaying as you\‘l in the SQL it is you\\’'ll

so,

input from the admin side: you’ll

on page: you\'ll

in sql: you\\''l

context (as dsiplayed on page): You have our promise that you\'ll get a job you absolutely love, 100% guaranteed!

If you made sure magic_quotes_gpc is set to off (I turned it on and tested it and it had no impact on my setup), then did you try reverting to the default theme and disabling all plugins? If you can, revert to the default theme, turn off all your plugins, try making a test post with plenty of apostrophes, and then see if the slashes are there on output. A search reveals you are not the only one who has had this problem with Wordpress, and it is difficult to find a cause. So, if it isn’t the theme you are using causing this then we can narrow it down to your server’s configuration. Just give it a try and report back.

Ok i reverted to the default (2011) theme. no slashes.

also tried 2010 and Bizway (another one from inkThemes) and no slashes. so it seems like it would be a theme issue.

im extremely confused because as i said previously the other sites i have been using the elitepro theme on have not had this problem.

OK, now that we narrowed it down…

You may be using the same theme as on other sites, but is everything exactly the same? Are you using plugins? In the theme you are having trouble with, is there any code in the functions.php file that adds or strips slashes?

Note: I discovered this problem on one other site using the same theme, but still others are not affected.

In functions.php there is nothing striping slashes, however in elite-funtions.php i found this:

/* Show analytics code in footer */
/* ---------------------------------------------------------------------------------- */
function elite_childtheme_analytics() {
    $output = elite_get_option('elite_analytics');
    if ($output <> "")
        echo stripslashes($output);
}
add_action('wp_head', 'elite_childtheme_analytics');

Now that you know your theme is tinkering with slashes, you are going to have to hunt around and try to find the source. Since this is a premium theme, your best bet is to ask the company that created it.