Se você usa o WordPress há algum tempo, há uma boa chance de que precise limpar seu site WordPress. Fazer limpezas regulares permite reduzir o tamanho do banco de dados, o que significa arquivos de backup menores e mais rápidos. Neste artigo, mostraremos como limpar o banco de dados do WordPress.
À medida que você usa o WordPress, seu banco de dados acumula muitos dados extras, como revisões, comentários de spam, comentários descartados, dados de plug-ins que você não está mais usando e muito mais. A remoção de todos esses dados desnecessários pode reduzir significativamente o tamanho do seu banco de dados, o que acelera o processo de backup e também pode trazer pequenas melhorias de desempenho.
Vamos dar uma olhada em como você pode limpar o banco de dados do WordPress.
Antes de começar, faça um backup!
Antes de fazer qualquer outra coisa, crie um backup completo do WordPress em seu site. As alterações feitas pelo plug-in de limpeza são irreversíveis. Embora ele não mexa diretamente com suas publicações ou comentários, é sempre melhor prevenir do que remediar.
Tutorial em vídeo
Se você não gostar do vídeo ou precisar de mais instruções, continue lendo.
Limpeza do banco de dados do WordPress com o WP-Sweep
A primeira coisa que você precisa fazer é instalar e ativar o plug-in WP-Sweep. Após a ativação, basta acessar Tools ” Sweep para limpar o banco de dados do WordPress.
Esse plug-in analisará seu banco de dados do WordPress e mostrará um relatório sobre a quantidade de lixo que pode ser limpa. O relatório de varredura é dividido em diferentes seções para suas postagens, comentários, meta do usuário, opções, termos e otimização do banco de dados.
Você pode percorrer os itens e limpá-los individualmente ou pode rolar até a parte inferior da página e clicar em varrer tudo para limpar tudo em seu banco de dados do WordPress.
A limpeza pode levar algum tempo, dependendo do tamanho do seu banco de dados. O WP-Sweep mostrará o progresso atualizando as estatísticas na página.
Por que o WP-Sweep e o WP-Optimize?
Você pode estar se perguntando por que estamos escrevendo sobre o WP-Sweep quando há um plug-in muito popular do WP-Optimize disponível que faz praticamente a mesma coisa.
Bem, isso se deve ao fato de ele ter sido programado por um desenvolvedor de WordPress muito respeitado, Lester Chan.
Também porque a principal característica distintiva do WP-Sweep é que ele usa as funções de exclusão adequadas do WordPress o máximo possível, em vez de executar consultas diretas de exclusão do MySQL. Enquanto o plug-in WP-Optimize usa consultas SQL de exclusão direta que podem deixar dados órfãos para trás.
Looking through WP-Optimize and they are using SQL query to delete post revisions which means there will be orphaned data left behind.
— Lester Chan (@gamerz) February 23, 2015
Em outras palavras, o WP-Sweep é um plugin mais bem codificado do que o WP-Optimize.
O que o WP-Sweep limpa?
O WP-Sweep usa todas as funções de exclusão adequadas do WordPress para limpar o banco de dados. No momento da redação deste artigo, ele pode limpar o seguinte:
- Revisões
- Rascunhos automáticos
- Comentários excluídos
- Comentários não aprovados
- Comentários com spam
- Comentários excluídos
- Meta de postagem órfã
- Meta de comentário órfão
- Meta de usuário órfão
- Relações de termos órfãos
- Termos não utilizados
- Meta de post duplicado
- Meta de comentário duplicado
- Meta de usuário duplicado
- Opções transitórias
- Otimiza as tabelas do banco de dados
- Caches incorporados no meta de postagem
Esperamos que este artigo tenha ajudado você a limpar seu site WordPress usando o WP-Sweep. Talvez você também queira dar uma olhada em nosso guia sobre os erros mais comuns do WordPress e como corrigi-los.
Se você gostou deste artigo, inscreva-se em nosso canal do YouTube para receber tutoriais em vídeo sobre o WordPress. Você também pode nos encontrar no Twitter e no Google+.
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!
Sally G. says
In terms of comments, does Empty Spam and Empty Trash do the same thing as this plug-in? I can certainly see where it would be useful for earlier revisions to a post, etc.
WPBeginner Support says
For sites just starting out it would be the same but as a site grows it can clean up information from comments that were deleted and a few other things
Administrador
Ed says
What a fantastic plugin. Has made such a difference to my website and increased the speed by a lot
WPBeginner Support says
Glad our recommendation was helpful
Administrador
Nivesh Gandhi says
Both are great plug ins. Normally you don’t even need to do backup. But its always good to be on safe side.
Dave says
WP Sweep – what a plugin. I have a WP site that hadn’t had much love over the past 18 months and somehow had a 1.4Gb DB. Worryingly WP Sweep managed to reduce that to just over 17MB.
More investigation needed.
Francis says
Hello , i have a question. Im using godaddy managed wordpress . They have a staging site. Can i use the staging site to clean up database then , push it to live production site after. Will it clean my database. Thanks
Jules says
2017 update? anyone else sharing their experience? Usability ?
Francisco Martínez says
Thank you!
Mike Patterson says
Thank you for the useful information on cleaning WordPress Site. This helps me a lot as my site is getting bulky and take a lot of time to get load.
Jan says
The absence of scheduling is a major disadvantage
Ramon says
Looked promissing but I’m not sure about the result. I had about 2600 revisions.. hoped cleaning them would make a difference but it didn’t, at least not in database size, might even be bigger now .. about 800MB.. What options are there to compact database if cleaning up doesn’t help?
By the way: looked like wp-sweep locked up a couple of times.. after refesh I noticed that the numbers were decreased and I started again, and again, and again till all revisions where removed. Can’t say I’m excited about wp-sweep but maybe I used it wrong, is that possible?
Ahmed says
Very nice post!
Cleaning database is very usefull especially for large ones.
I have used the Advanced Database Cleaner, it is also very powerful and provides many features such as scheduling the cleaning of database and more…
Chris says
I really enjoyed this article, the layout, and the links. I really just had to say I appreciate the 50 second video that quickly and easily explained what to do and the lead in of backing up your site with a quick little article to find a backup service. I’m new to WP and blogging but trying to learn fast and after viewing this page I can tell I’m going to be spending a lot of time on your site! Well done and thanks!
Gerard says
Nice job .. on article and plugin … Are the WP-Sweep commands visible under WP-CLI?
Ta!
Gerard.
Anna says
I had wp optimize on my “to install” list, but after seeing this post I downloaded WP sweep. it’s so easy to use. I usually clean up my spam comments, but I know that I have a lot of revisions on my posts so it’s good to get rid of those!
Bhongo says
yet another great article. Good job guys, I have never thought about about a database clean-up for my WP sites but now thanks to you, I will be doing a clean-up ASAP.
Nikky says
We’ve been using Wp-Optimize plugin and it works great with similar options to the plugin mentioned above. What you suggest Wp-Optimize or WP-Sweep ?
Lester Chan says
Thanks for the review =)
WPBeginner Support says
Thanks for writing and sharing such useful plugin with the community.
Administrador
BDorin says
Great and really easy to use but before make a back-up it is very important.
KennyTheMap says
Certainly cleaned up a lot of trash from my main website.
Like Broken Link Checker it is a really useful plugin.
A question; I deactivate such plugins until I next need to use them as I gather that can improve performance. Is my assumption correct?
Thanks, Kenny
WPBeginner Support says
Properly coded plugins will not affect your site’s performance when you are not using them. But there can be plugins that will add additional style sheets or JavaScript even if you are not using them. So it is best to deactivate the plugins you are not using.
Administrador
Marcelo says
Whoa! I’ll be switching almost right now, unless the author of WP-Optimize upgrade its plugin this week
Dave says
I agree! I have used a bunch of tools for this purpose before, with mostly good results. But this plugin is SO much easier to use, and really did a great job of cleaning.
Of course, some people won’t heed the clear warning to back up first, but that’s human nature, I suppose.
A super job by Lester Chan, an under-appreciated outstanding coder and contributor to WordPress!
Dave
Kenneth Adair says
I deleted the wp-optimize and added the wp-sweep but where does one see what the database size is before and after sweeping?
Marcelo says
That’s the thing with this Sweep plugin. Its author wants things clear, simple, and minimalistic. But I think the UI for such a critical tool like a database cleaning, should be more detailed.
Also, the lack of a scheduling feature will make it pass unnoticed.
I think the best approach would be if Ruhani Rabin could upgrade its own and well known plugin to use official, native, WP queries to the cleaning. I will ask him what does he think about it.
https://github.com/ruhanirabin/WP-Optimize/issues/60
Lester Chan is a great programmer, but I wouldn’t like to abandon WP-Optimize because of the approach.
What do you think guys?
Best regards