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

Como desativar os editores de temas e plug-ins no painel de administração do WordPress

Nota editorial: Ganhamos uma comissão de links de parceiros no WPBeginner. As comissões não afetam as opiniões ou avaliações de nossos editores. Saiba mais sobre Processo editorial.

Você sabia que o WordPress vem com um editor de temas e plugins integrado? Esse editor de código simples permite que você edite seus arquivos de tema e plug-in diretamente no painel do WordPress.

Isso pode parecer muito útil, mas também pode levar a problemas como a quebra do seu site e possíveis problemas de segurança quando combinado com outras vulnerabilidades.

Neste artigo, explicaremos por que e como desativar os editores de temas e plug-ins na área de administração do WordPress.

Disable theme and plugin editors in WordPress admin area

Por que desativar os editores de temas e plug-ins no WordPress?

O WordPress vem com um editor de código integrado que permite editar arquivos de temas e plug-ins do WordPress diretamente da área de administração.

O editor de temas está localizado na página Appearance ” Theme File Editor. Por padrão, ele mostrará os arquivos do seu tema ativo no momento.

Theme file editor in WordPress

Da mesma forma, o editor de plugins pode ser visto na página Plugins ” Plugin File Editor. Por padrão, ele mostrará um dos plug-ins instalados em seu site que aparece primeiro em ordem alfabética.

Plugin file editor in WordPress

Se você visitar a página do editor de temas ou plug-ins pela primeira vez, o WordPress avisará que o uso do editor pode danificar seu site.

Theme editor warning in WordPress

No WordPress 4.9, os editores de temas e plug-ins foram atualizados para proteger os usuários contra a quebra acidental de seus sites. Na maioria dos casos, o editor detectará um erro fatal e reverterá as alterações.

No entanto, isso não é garantido e algum código ainda pode escapar e você acabará perdendo o acesso à área de administração do WordPress.

O maior problema do editor de arquivos incorporado é que ele dá acesso total para adicionar qualquer tipo de código ao seu site.

Se um hacker invadir sua área de administração do WordPress, ele poderá usar o editor integrado para obter acesso a todos os seus dados do WordPress.

Os hackers também podem usá-lo para distribuir malware ou lançar ataques DDOS a partir de seu site WordPress.

Para aumentar a segurança do WordPress, recomendamos remover completamente os editores de arquivos incorporados.

Dito isso, vamos ver como desativar facilmente os editores de temas e plugins no WordPress.

Como desativar os editores de temas e plug-ins no WordPress

Desativar os editores de temas e plugins no WordPress é bastante fácil. No entanto, isso requer a adição de código no WordPress. Se você nunca fez isso antes, consulte nosso guia sobre como colar trechos da Web no WordPress.

Você precisará adicionar essa linha de código ao arquivo functions.php do seu tema, a um plug-in específico do site ou usando um plug-in de snippets de código.

define( 'DISALLOW_FILE_EDIT', true );

Recomendamos o uso do plug-in WPCode porque ele é gratuito, fácil de usar e não danificará seu site se algo der errado.

Observação: há também uma versão premium do WPCode que vem com recursos avançados, como revisões de código, pixels de conversão automática, snippets programados e muito mais.

Primeiro, você precisará instalar e ativar o plug-in gratuito WPCode. Para obter instruções detalhadas, consulte nosso guia sobre como instalar um plug-in do WordPress.

Depois que o plug-in estiver ativado, vá para Code Snippets Add Snippet no painel do WordPress. Em seguida, passe o mouse sobre a opção “Add Your Custom Code (New Snippet)” (Adicionar seu código personalizado (novo snippet)) e clique no botão “Use snippet” (Usar snippet).

Add a new custom code snippet in WPCode

Em seguida, adicione um título para seu snippet e cole o código acima na caixa “Code Preview” (Visualização de código). Você também precisa selecionar “PHP Snippet” como o tipo de código no menu suspenso à direita.

Paste code snippet into WPCode

Depois disso, basta alternar a chave de “Inativo” para “Ativo” e clicar no botão “Salvar snippet”.

Activate and save your custom code snippet

Isso é tudo, os editores de plugins e temas desaparecerão dos menus de temas e plugins na área de administração do WordPress.

Como alternativa, você também pode editar seu arquivo wp-config.php e colar o código acima logo antes da linha que diz “That’s all, stop editing! Feliz publicação”:

Em seguida, salve as alterações e carregue o arquivo de volta em seu site.

Se não quiser editar os arquivos diretamente, você pode instalar o plug-in Sucuri WordPress, que oferece o recurso de proteção com um clique.

Maneira correta de editar arquivos de temas e plug-ins do WordPress

Muitos usuários realmente usam os editores de temas e plugins do WordPress para procurar o código, adicionar CSS personalizado ou editar o código em seus temas filhos.

Se você quiser apenas adicionar CSS personalizado ao tema, poderá fazê-lo usando o personalizador de temas localizado em Appearance ” Customize.

Adding custom CSS via theme customizer

Para obter mais detalhes, consulte nosso guia sobre como adicionar CSS personalizado no WordPress sem danificar seu site.

Se quiser procurar o código em um plug-in, você pode fazer isso usando um cliente FTP.

Para um melhor gerenciamento de arquivos e realce de sintaxe, você pode usar um desses editores de código para editar arquivos do WordPress em seu computador.

Por último, mas não menos importante, você também pode criar um tema personalizado do WordPress sem escrever nenhum código.

Esperamos que este artigo tenha ajudado você a aprender como desativar facilmente os editores de temas e plug-ins no painel de administração do WordPress. Talvez você também queira ver nosso guia definitivo para melhorar o desempenho e a velocidade do WordPress ou nossa seleção de especialistas do melhor software de web design.

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 Facebook.

Divulgação: Nosso conteúdo é apoiado pelo leitor. Isso significa que, se você clicar em alguns de nossos links, poderemos receber uma comissão. Veja como o WPBeginner é financiado, por que isso é importante e como você pode nos apoiar. Aqui está nosso processo editorial.

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.

O kit de ferramentas definitivo WordPress

Obtenha acesso GRATUITO ao nosso kit de ferramentas - uma coleção de produtos e recursos relacionados ao WordPress que todo profissional deve ter!

Reader Interactions

33 ComentáriosDeixe uma resposta

  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. Jiří Vaněk says

    Thanks for the tutorial. I used the wp-config.php file and it works great. Especially for customer sites, this option seems very good to me, so that they don’t modify the codes of the site and also in terms of security.

    In the end, I chose the wp-config file mainly so that this function could not be simply turned off from the administration, where it didn’t make any sense to me.

  3. Bob Putnak says

    This wont accomplish anything these days.
    1) Using the CODE SNIPPETS solution, if the hacker has access to the admin panel, they will simply go to the CODE SNIPPETS panel and DISABLE the snippet.

    2) Likewise, if you added it to the wp-config file, I cant see any reason why someone with access to the Admin panel could not simply INSTALL the CODE SNIPPETS plugin, activate it, then set a rule for:

    define( ‘DISALLOW_FILE_EDIT’, true );

    Seems to me that if the hacker has access to the admin panel, there is absolutely no solution to this problem.

    If you disagree, please explain why. My login seems 100% sound.

    • WPBeginner Support says

      If someone has admin level access to your site then they could look to add a plugin to bypass the issue. There are other user roles that have access to these sections of your site but not the ability to add plugins and this can help protect you from a non-admin who has this level of access from getting into your files.

      Administrador

  4. isabella says

    Hello there! I have the opposite problem I need to add a CSS code in the editor BUT the editor disappeared.
    Do you have any suggestions?
    thanks a lot
    cheers

  5. Raj says

    Unfortunately this isn’t working for me, I have updated the wp-config.php file but the editor option is still there in my wp dashboard, can you suggest me something?

    • Dave says

      Hi Raj,

      I had the same issue, but was able to fix it. Not sure if this is your same issue, but I realized that when copy/pasting from an internet post, sometimes the single/double quotation marks (‘ ‘) or (” “) may be a curly quote vs. a straight quote. Try deleting the single quotes, and retyping them.

      Hope this helps!

      -Dave

  6. William Marques says

    Is it possible disable save option for all? I want show control panel for my clients, but I do not want that they save the changes.

  7. Bella says

    A trillion thank you’s!!

    This tiny piece of code has rocked my world!

    How have I not come across you in the past??

    Keep smiling – Bella

  8. Jimit Shah says

    hi
    I want to disable paste command ( through mouse and ctr+v)in my php file in theme editor. So that i can write code not copy any code from outside.I want to give access manual code writing . please help me

  9. Raja Dileep Kumar says

    define(‘DISALLOW_FILE_EDIT’, true); this function will work on themes/functions.php if i paste the code in wordpress

  10. John McNamara says

    Hi there just wondering if anyone found a way to get around this without access as we have paid $1800 for some to set up a Website that is just a theme with out any changes made to it and wants to be paid more to unlock the editor for us
    Please help!!

  11. Prasath says

    define( ‘DISALLOW_FILE_EDIT’, true );

    This one disable the editor for complete pages. I need to disable only for home page and for particular user(for Ex: Editor) . Coz I used page builder. My clients are not intrested to look over that..

    Can any one help me ….

  12. Mark Corder says

    I can also confirm that this works when the line is added to a Site-Specific Plugin – which you’ll also find the recipe for here on WPBeginner…

    … so Thanks to you folks for all of it!

  13. Melissa says

    Hey there! My cheeky developer has done this to me and I need access… is there a way to “undo” this clever trick without having FTP access?

    I am also a developer and able to edit the files without any issues, but my contracted developer wants to charge me to access the code… so I am hoping I can jump in somehow!

    Mel

    • Al Klein says

      Did you contract for ‘all deliverables’? If so, have him deliver the FTP password – it’s a deliverable. (It’s a contract, so it can be enforced by a court. You may not be able to sue for specific action, but you can sue for whatever it will cost to have another developer create a new site that’s exactly like the old one [which will probably bankrupt your existing developer – so it will make him prone to turn everything over to you].)

      If you didn’t have ‘all deliverables’ included in the contract, or don’t have a signed contract, consider it a cheap legal lesson. (Law school costs a lot more.)

      • Bill says

        Great tip.
        Is there a way to disable a specific editor (for example Elementor) for a specific post (page) type while still allowing access to the classic editor?
        I hope this can be done in the child functions file.

  14. Suresh Khanal says

    while reading this post I was wondering why would anyone need to hide the editor link in the WordPress Admin because it is only the administrators who gain access to those links and if they do not get permission to do the things the required, what’s the use? anywhere realize that is good with it helpful when you are setting up blogs for you clients. Thanks for the good tips.

  15. Mark Corder says

    This is an excellent tip – and it worked fine for me adding the line to the functions.php file in my twentytwelve-child-theme’s folder. I still see options for customizing the theme (header, background, etc.) – but the “editor” links are now gone. (I had to press CTRL-R to force a page reload to make them disappear.)

    I always try to remove everything from the backend that a client really shouldn’t be messing with, and those plugin & theme editors are just inviting disaster! It’s wonderful to be able to remove them with a single line of code…

    I really appreciate these tips that edit child-theme functions and files to accomplish something rather than just recommending another plugin – though I realize this departs a bit from the “beginner” stuff.

    And if you haven’t had this request a thousand times already, I’d love to see you folks open a “WPAdvanced” site for us hard-core folks!

    • Editorial Staff says

      Thanks for the feedback Mark. Yes, we have gotten the request for WPAdvanced in the past. For now our focus is to continue to improve WPBeginner (we’re still not there yet).

      -Syed

      Administrador

  16. Gray Ayer says

    A problem encountered with this technique is that it also prevents anyone from upgrading the outdated plugins. Any ideas on that, besides disabling the addition to the wp-config file, upgrading, then restoring the hardened security?

  17. joanpique says

    Hi, thanks for the tip, yes, it works on functions.php file.

    But this code turn me off my theme options page :(…, is there any other code that only hide editors or something to put in the options page for avoid hidding?

Deixe uma resposta

Obrigado por deixar um comentário. Lembre-se de que todos os comentários são moderados de acordo com nossos política de comentários, e seu endereço de e-mail NÃO será publicado. NÃO use palavras-chave no campo do nome. Vamos ter uma conversa pessoal e significativa.