WordPress.org

Ready to get started?Download WordPress

Forums

p tags in my content - invalidating mark-up (9 posts)

  1. lance_kidd
    Member
    Posted 2 years ago #

    I have the visual editor disabled. Why is WP wrapping my content in p tags. There is one closing </p> tag after an image that I inserted. I do NOT want WordPress touching ANYTHING that I write in the editor.

    If it's something I'm doing wrong, and someone knows for sure, please tell me. This is making me mad.

  2. lance_kidd
    Member
    Posted 2 years ago #

    I found a workable solution from about three years ago in the support forums. Anyway, I had to comment this line out in wp-includes/default-filters.php:

    //add_filter( 'the_content', 'wpautop' );

    I thought WP had grown to be a little more sophisticated than spitting out closing tags where they do not belong and invalidating code mark-up with silliness like this.

    Yea, I said it!

  3. JarretC
    Member
    Posted 2 years ago #

    Were you using the default Twentyten/Twentyeleven theme with no plugins activated? It could be an issue with a theme or a plugin that you have installed.

    Modifying core files isn't recommended at all.

  4. lance_kidd
    Member
    Posted 2 years ago #

    Thanks for replying Jarret. I'm using the Graphene theme, but I use a child theme to do all my modifications. However, you're right about that specific file though.

    I'm going to look at it in more detail tonight. If I have to, I will install fresh on my WAMP server with no plugins.

    WordPress seems to do this though even with the visual editor disabled. Am I the only one having the problem? I will definately check more thoroughly though and get back if I find it's a theme or plug-in issue.

  5. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    I always use the html Editor, and it works with all the themes I use. So, it cannot be a typical WordPress problem.

  6. fonglh
    Member
    Posted 2 years ago #

    It's not a problem, it's by design. If you don't like it, disable the feature.

    See http://codex.wordpress.org/Function_Reference/wpautop (the section on disabling the filter).

    It does what you've done, but without having to modify core files.

  7. lance_kidd
    Member
    Posted 2 years ago #

    Thanks everyone. I will make that change and fix the core file I modified. Much appreciated.

  8. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    You are welcome!

  9. Mattdaddy71
    Member
    Posted 1 year ago #

    Crossing my fingers that WordPress development gives users an option to disable automatic <p> tags without having to be a .php developer or add some crazy plugin.

    I too do not want WP touching ANYTHING that I write in the HTML editor.

    In my case I'm using a custom theme with additional .js here and there. The addition of an automatic <p> tag is causing my markup to be invalid.

    Help???

Topic Closed

This topic has been closed to new replies.

About this Topic