WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] phpMyadmin to replace text (12 posts)

  1. Jimwalt
    Member
    Posted 2 years ago #

    I used the search and replace plugin to replace this text: img src= with a nonsense phrase of "bulldog" on a simple WordPress site. The net result was that images in posts have been effectively disabled.

    The plug-in does not work on a multiuser installation with hundreds of tables to deal with.

    I am looking for the correct syntax to use to run an SQL command(?) that will replace "img src=" with my nonsense phrase of "bulldog" across all tables of the various users.

    Also, perfectly willing to hire an experienced person to clean up four sites for me. Just need to disable all existing images in posts thanks to Getty Images not believing in cease and desist (remove our copyrighted image or else). Instead they just sue for thousands of dollars.

  2. I am looking for the correct syntax to use to run an SQL command(?) that will replace "img src=" with my nonsense phrase of "bulldog" across all tables of the various users.

    UPDATE wp_posts SET post_content = replace(post_content,"img src=","bulldog")

    Except... That will break all your images, you understand, right?

    I mean, you seem to be complaining that the images broke:

    I used the search and replace plugin to replace this text: img src= with a nonsense phrase of "bulldog" on a simple WordPress site. The net result was that images in posts have been effectively disabled.

    And yes that's what happens when you REMOVE the call to "img src="

    What are you actually trying to do? Break all the images or ... what?

  3. Jimwalt
    Member
    Posted 2 years ago #

    Yes, I am trying to purposely break all of the images. Getty Images has sued me because they found a copyrighted images on my site so I need to break all images currently on any of the blogs in case they too are copyright protected.

    UPDATE wp_posts SET post_content = replace(post_content,"img src=","bulldog")

    The above works for a simple WordPress but how to change all of the posts when there are hundreds and named wp_1_posts, wp_2_posts, etc. The above command only changes the text in wp-posts.

  4. Jimwalt
    Member
    Posted 2 years ago #

    There are 900+ users in one of my installations. I would hate to have to run the modified command 900+ times.

  5. Ohhh. Okay. You want to do it for ALL sites (that was unclear). Okay, there isn't a single SQL command that'll do that. It's just not how it works (probably to protect us from silly things).

    UPDATE wp_1_posts SET post_content = replace(post_content,"img src=","bulldog");
    UPDATE wp_2_posts SET post_content = replace(post_content,"img src=","bulldog");

    You can take that, edit it in a text editor and have it repeat 999 times (yes, 999 lines, but better than pasting in that many times.

    But.... I would consider doing it differently, and instead do a bit of .htaccess trickery so you can keep the images and review them.

    Or shut down the one site and then contact all the people who host with you and tell them 'If I find you're using illegal images, you're going to lose everything.' Depends on the nature of the Getty suit.

  6. Jimwalt
    Member
    Posted 2 years ago #

    Ah, I had no idea I could do it that way. 999 separate lines all at one time?

    UPDATE wp_1_posts SET post_content = replace(post_content,"img src=","bulldog");
    UPDATE wp_2_posts SET post_content = replace(post_content,"img src=","bulldog");

    I could do it in Excel, auto increment the _1_, copy it all into a text editor then recopy it once it is straight text and literally paste 999 lines (or whatever) all at one time?

    Yes, I can do that. But if you can confirm that I can post 999 lines into phpMyadmin hit the GO button (or whatever) and phpMyadmin should not choke?

  7. Jimwalt
    Member
    Posted 2 years ago #

    http://wordpress.org/extend/plugins/searchreplace/
    http://wordpress.org/extend/plugins/search-and-replace/
    http://wordpress.org/extend/plugins/search-regex/

    I will check these out, too. The one last written by Frank somebody does not work on Multiuser sites. He is aware of that fact. I'll check out the other two also but I do like the option above of 999 line command.

  8. could do it in Excel, auto increment the _1_, copy it all into a text editor then recopy it once it is straight text and literally paste 999 lines (or whatever) all at one time?

    Just be VERY careful, but yes, you can totally do that. phpMyAdmin choking would be more dependent on how many posts per table you have, though. Split it up by 50, and that's still only 18 times, vs 900 ;)

    Make a backup first.

    Most plugins would only do it per-site, though.

  9. Jimwalt
    Member
    Posted 2 years ago #

    Blocks of 50 is what I was thinking too, though I'm going to do one, then five a couple of times to make sure I have it right before I hit it with 50 at a time.

    I don't actually see the one phrase you used, post_content, but I'm guessing that is a pretty generic thing and virtually all WP installs have it?

  10. Jimwalt
    Member
    Posted 2 years ago #

    Ipstenu, thank you very much.

    Thanks primarily to you I was able to rescue 6 websites and each one only took me 10 to 15 minutes to clean up. I was quoted prices of up to $200 to take care of 2 of the websites and the last "expert" scratched his head (so-to-speak) after his first couple of plans didn't work, and wrote to me, "I guess I'm going to have to do it through phpmyadmin, right in the database", which is what I had hired him to do in the first place, I thought.

    I had wasted three or four entire days trying to figure out how this should be done. And then I saw your posts. Again, thank you.

  11. Not a problem :) (FWIW, $200 to do that for you is not a drastic price. It's about right for a 30min to an hour gig, which would have included coming up with the commands to run. Seems like a lot, but then you realize folks have to make a living.)

    I accept cookies and coffee ;)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.