Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Så här gör du Sök och ersätt i WordPress med ett plugin

Letar du efter att göra search and replace i WordPress? Senast frågade en av våra användare oss hur man kan run search and replace på WordPress database utan att skriva någon SQL-kod eller använda phpMyAdmin. Många Beginnare är inte bekväma med kod, så det är därför vi hittade ett search and replace plugin för WordPress. I den här artikeln visar vi dig hur du gör search and replace i WordPress.

Search and replace text in WordPress database

Kom igång

Det är mycket viktigt att du gör en komplett backup av WordPress innan du gör några ändringar i din WordPress database.

Gör detta till en vana, för det kan alltid gå fel när du gör direkta ändringar i WordPress databasen. Om du har en backup kan du enkelt återställa din WordPress site utan att förlora något.

Installera och använda Better Search and Replace för WordPress

Det första du behöver göra är att installera och aktivera pluginet Better Search Replace. När du har aktiverat det måste du besöka Tools ” Better Search Replace page för att använda pluginet.

Better search replace plugin settings

Lägg bara till den textsträng du vill söka efter och lägg sedan till ersättningstexten.

Därefter måste du selecta de tabeller du vill titta i. Om du till exempel vill searcha och ersätta text i dina posts kanske du vill selecta tabellen posts. Du kan också selecta flera tabeller om du vill.

Läs mer om hantering av WordPress Database table och vad varje tabell gör i WordPress.

Pluginet kan runna en skiftlägeskänslig search och replace. Det kan också utföra en torr run som allow you att se hur många celler som påverkas av your search utan att faktiskt ersätta texten.

När du är nöjd klickar du på knappen Run search/replace. Om du ej kontrollerat alternativet torrkörning kommer pluginet nu att runna search och replace på din WordPress database.

Felsökning

Du kan se den vita vyn eller run på timeouts när du utför en search och replace. Klicka bara på tabben Settings under plugin-sidan.

Troubleshooting timeouts during search and replace

You will notice the max page size alternativ. Försök att minska storleken på page för att undvika timeouts och vit vy.

Det var allt, vi hoppas att den här artikeln hjälpte dig att hitta ett bättre search and replace plugin för WordPress database. Du kanske också vill se vår tutorial om hur du rensar upp din WordPress-databas för förbättrad prestanda.

Om du gillade den här artikeln, vänligen prenumerera på vår YouTube-kanal för WordPress video tutorials. Du kan också hitta oss på Twitter och Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

25 kommentarerLämna ett svar

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Dayo Olobayo says

    Upgrading to the premium version of this plugin was worth every penny. The advanced features like case-sensitivity and selective table targeting saved me so much time. Definitely a must-have tool in my WordPress toolkit.

    • WPBeginner Support says

      The plugin does have the ability to search what was added through other plugins, you would mainly want to make ensure you search the correct tables.

      Administratör

  3. Paul G says

    Thanks, this mostly worked for me but didn’t quite change all of the image links.

    The rest I could easily change myself by editing the custom modules.

  4. Karol says

    Changed a website from http to https via cpanel; green lock did not appear and ”connection is not secure” warning was present. This plugin worked great for me. The only difference I did was that I left the checkmark off ”Case Insensitive?”.

    Every site can be different with it’s own hurdles to jump through but the dry run seemed to look okay without any errors so I ran with it. Green lock appeared right away for the site. Plugin worked for me. I hope it continues to work with other sites.

    My only question now is … Do I leave the Better Search Replace plugin installed and activated or do I uninstall it now that I’m done?

    • WPBeginner Support says

      That would be a personal preference question but you should be able to remove the plugin without worry :)

      Administratör

  5. Mandy says

    Hello,

    My site is having issues showing images lately, and my host said that it’s because the paths are wrong. They recommended this plug in, but my problem is that I am not sure what I am searching and replacing. Here’s why:

    When I insert an image in ”visual” mode within a post, it shows up. They all do.
    Then when I preview or publish, some images don’t show up. What I am noticing lately is that instead of the code showing them as ”image.jpg”, they now have the image size you choose in the path – ”image-300×188.jpg” (this happens to be the medium size for this particular image). Why is it putting the pixel dimensions? If none of the images worked, I could say yes, the paths are incorrect, but some images DO work! I am officially bamboozled. It seems so random.

    Best,

    Mandy

  6. Ashraf Ali says

    I am switching from http to https now the common problem faced is broken css, I am wondering if could use this plugin to replace https:// to just //

    So that all contents are delivered over https

    Cheers

  7. Drew says

    I had a program enter structured data that is all different. I want to remove everything between and including this : ———————-

    How would I do that?

    • WPBeginner Support says

      Hi Drew,

      We are not sure we completely understand your issue. However, we are guessing that you had a plugin to add structured data and now you want to remove the structured data from your WordPress posts and pages? If this is the case, then you can simply uninstall the plugin.

      Administratör

  8. Sueli says

    Great plugin!

    I have a question.
    Can I use a wildcard?

    I am trying to remove numbers added after an image file. They are different (both the numbers and their length). The stop point would be the (”).

    Some examples of what I want to replace with (jpg”)
    (jpg?11906004322295206140″)
    (jpg?15231215847335105667″)
    (jpg?82668654789154738″)

    Is it possible with this plugin?

    Thanks

  9. David says

    I download ”Better Search & Replace. Once it found entries, it doesn’t show me unless I buy premium addon.

    So instead I ditched that and downloaded ”Search & Replace”. It took me only two minutes to replace 100 entries.

  10. Ralpheal says

    Wow thanks so much, this is truly a luxury. Going to save me a lot of time, as I was considering changing a phone number on 1oo’s of blog posts.

    Thanks so much, :)

    Ralpheal

  11. Mike says

    This plugin did not work for me. I backed up the database, then unchecked ”Dry Run”. It messed up things all over the site and there was no way to undo the changes.

    I even tried to restore the database backup I created with it before making changes and that didn’t work. Don’t use this unless you’re prepared to do an entire site restoration.

  12. vikas kumar says

    sir
    help me out from pagination error i did which you show in video but i didn’t get result
    i am using macbook air in this your given shortcode not work properly

  13. Marko Tiosavljevic says

    yes, but this plugin is practically useless when it comes to migrations.

    When you migrate website from domain . com to another . com you need to change

    you need to connect to database for changing url or you need to insert it in wp_config as url

    i am working on external app wp safe mode that is solving this problems in best way.

  14. Nico says

    Hi, it seems that this plugin is no longer available in WordPress Plugin Directory. Which alternative plugin do you recommend?

    With kind regars,
    Nico.

  15. Brian says

    Does this take into account serialize data or will it break plugins that use serialized metadata? I know of a few plugins that do this for migration purposes. If it doesn’t it could cause more problems than it solves.

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.