WordPress.org

Ready to get started?Download WordPress

Forums

Automatic removal of old BR tags? (10 posts)

  1. Michael Heilemann
    Member
    Posted 10 years ago #

    Can someone conjure up an SQL query or something that can help me remove all the old ooold B2 BR tags in the entries that I still have from those days?

  2. JoshuaClinard
    Member
    Posted 10 years ago #

    I wouldn't mind having such an option myself.

  3. Michael Heilemann
    Member
    Posted 10 years ago #

    bump ;)

  4. Mike Little
    Member
    Posted 10 years ago #

    Try this, but make a backup first.

    update wp_posts set post_content = replace(post_content, '<br />', '');

    Mike

  5. Michael Heilemann
    Member
    Posted 10 years ago #

    Thank you ever so much. Including comments corrected I had a total of 500 breaks removed :)

  6. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    Nice! Good job Mike, I didn't know you could do that directly in SQL.

  7. gfmorris
    Member
    Posted 10 years ago #

    I (heart) the UPDATE function. :D
    http://www.mysql.com/doc/en/UPDATE.html
    To be clear, that's two single quotes at the end of his query, not a double quote.

  8. gfmorris
    Member
    Posted 10 years ago #

    Amaaaaaaaaaaaaazing:
    "Affected rows: 869 (Query took 0.0298 sec)"
    Less than three hundredths of a second. Oi.

  9. justin2311
    Member
    Posted 9 years ago #

    i'm an sql noob

    where am i supposed to put the...

    update wp_posts set post_content = replace(post_content, '
    ', '');

    ...thing?

  10. Kafkaesqui

    Posted 9 years ago #

    It actually should be this:

    UPDATE wp_posts SET post_content = REPLACE(post_content, '<br />, '');

    or for old school HTML, this:

    UPDATE wp_posts SET post_content = REPLACE(post_content, '<br>', '');

    And it's a SQL query for use on your database. If you have access to a tool like phpMyAdmin, go into your WordPress database through it, click the SQL tab, and enter the query there.

    Note: Backing up your database first is ALWAYS a good thing.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.