WordPress.org

Ready to get started?Download WordPress

Forums

Require HTML validation and filter for new content (2 posts)

  1. parka
    Member
    Posted 6 years ago #

    I'll get straight to the point.

    If I write a new post with the following content, it will break the page where the content will appear.

    </div></div></div></div></div>

    Or anything that's a closing tag.

    The problem is, the WordPress installation might be used by more than one people who might not know HTML. 0% knowledge in HTML. They might accidently type in a closing tag for whatever reason.

    Is there a way to filter or validate the code before it gets publish.

    E.g. Blogspot doesn't allow faulty code to be published. Drupal doesn't allow faulty code to be published.

  2. scribblerguy
    Member
    Posted 6 years ago #

    Since WordPress 2.0, WP has included a visual editor (TinyMCE). Users of WP don't need to know HTML.

    If I write a new post with the following content, it will break the page where the content will appear.

    </div></div></div></div></div>

    Or anything that's a closing tag.

    Not in the visual editor of the current version of WordPress (2.5.1):

    In WP 2.5, the visual editor automatically converts greater-than, less-than, and other symbols to their respect entity values (&gt;, <, etc.)*

    In WP 2.5, if one switches back and forth from the code editor to the visual editor, nesting errors are automatically corrected.*

    If a (1) user enters something in the "code view;" (2) the user does not switch back to the visual editor before saving the post; and (3) the "correct invalidly nested XHTML" option (see below) is not checked, then the above is possible.*

    And, yes, if a user enters code in the visual editor of the 2.0 legacy branch, that is not automatically corrected or converted to entities.*

    Is there a way to filter or validate the code before it gets publish.

    Don't use the code view. Or, if you are using the code view, then in the Settings > Writing page, mark the checkbox labeled " WordPress should correct invalidly nested XHTML automatically". This is unchecked by default, as most users only use the visual editor and (as I understand it,) for plugin compatibility issues. See the Codex page for the Writing options subpanel). And, if one is obsessive about validation, they can always manually run their pages through the W3 validator.

    *I checked all of this on new, clean installs of WP 2.0.11 and WP 2.5.1.

Topic Closed

This topic has been closed to new replies.

About this Topic