We've determined the issue is not Genesis. It's a WordPress core function that is making this change. There isn't anything we can do to prevent it from happening. It's applying this change to all content output by the_content() function.
You can actually see the line of code yourself by opening wp-includes/post-template.php and going to line 168.
Here is the line of code that is causing the validation problem:
$content = str_replace(']]>', '& g t ;>', $content);
So the built in the_content() function is replacing all instances of ]]> with ]]> which doesn't make a whole lot of sense. There has to be a valid reason why this code is in place, although I couldn't tell you what it is.
The end result is code where this change exists, the code that is output won't validate.
So Gravity Forms code is correct, but it's being changed by WordPress core so it won't validate. Right now we don't have a solution because when you embed a form into page or post content and display it using the_content() function our code is run before this happens.
I've been trying to determine why this code is in core but no luck yet.
The only solution right now is either..
1) Ignore the validation errors, invalid code is not "broken". It will still work and function, it just means it hasn't passed validation. At a time when many sites are now mixing XHTML and HTML5 that isn't as big a deal.
2) Display the form using the function call rather than the shortcode. This issue only happens when the form is embeded in a page or post that is then output using the_content() function. If the form is displayed via the function call in a theme template file itself, this doesn't happen. If a form is displayed via a widget, this also won't happen. It's only when the_content() comes into play.
We'll continue to look into this but right now it looks like a core WordPress feature that is manipulating the output negatively.
Posted 7 years ago on Monday December 5, 2011 | Permalink