PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

HTML causing error in Post Content Template

  1. jaylandry
    Member

    Hi,

    Great plugin, but I'm having a problem with the Post Content Template. It allows simple tags like b and i, but whenever I try to add anything like href, img src, or any style tags at all, it tells me there was an error and it couldn't be saved. I have deactivated all my plugins but it hasn't helped. My GF and WP are up to date.

    Any ideas why this is happening?

    Thanks!

    Posted 13 years ago on Monday March 7, 2011 | Permalink
  2. This could be a mod_security issue. Can you send us a WordPress admin login for this site via our Contact Us form and reference this forum post so we can take a look and see whats going on?

    Posted 13 years ago on Monday March 7, 2011 | Permalink
  3. jaylandry
    Member

    I sent the info over the Contact Us form.
    Thanks for your help, Carl.

    Posted 13 years ago on Monday March 7, 2011 | Permalink
  4. This is happening because your theme is doing something that it should not be doing on purpose. It's applying the stripslashes function call to ANYTHING that posts. This is bad. Very bad. Plugins aren't expecting this to happen so it can cause problems.

    Gravity Forms uses AJAX and utilizes slashes in the code, your theme is stripping out the slashes because it's applying this to all POST actions. So any form that is submitted, including the form editor. This is bad because your theme is assuming it's all right to globally do this, when it is not.

    The code is in your themes functions.php at the top. It looks like this:

    if ( get_magic_quotes_gpc() ) {
        $_POST      = array_map( 'stripslashes_deep', $_POST );
        $_GET       = array_map( 'stripslashes_deep', $_GET );
        $_COOKIE    = array_map( 'stripslashes_deep', $_COOKIE );
        $_REQUEST   = array_map( 'stripslashes_deep', $_REQUEST );
    }

    I would suggest removing that code and testing your theme. They shouldn't be doing this.

    Posted 13 years ago on Monday March 7, 2011 | Permalink
  5. This issue is due to the theme applying stripslashes_deep to the global $_POST variable which themes should not be doing. This code is in your themes functions.php file at the top and should be removed. Once you remove it, the functionality will work as expected.

    Posted 13 years ago on Monday March 7, 2011 | Permalink
  6. jaylandry
    Member

    Carl, you're the man! I edited and replaced the functions file, and it is working perfectly.
    Thanks a lot! This is seriously going to help my site!

    Posted 13 years ago on Monday March 7, 2011 | Permalink