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

Come limitare l’uploader solo a determinati tipi di file in WordPress

Nota editoriale: guadagniamo una commissione dai link dei partner su WPBeginner. Le commissioni non influenzano le opinioni o le valutazioni dei nostri redattori. Per saperne di più su Processo editoriale.

Qualche giorno fa, durante l’elaborazione in corso sul sito di un cliente, ci è stato chiesto di codificare una funzione che limitasse l’uploader solo a determinati tipi di file (jpg, gif, png). Dopo aver cercato nel repository e non aver trovato nulla che potesse farlo, abbiamo deciso di creare un plugin tutto nostro. Ieri è stato approvato nel repository dei plugin di WordPress e si chiama Restrict Uploads.

A differenza di altri plugin, questo NON ha un pannello di impostazioni super complesso. In effetti, non ha alcun pannello di impostazioni. È stato creato per fare una cosa e una sola. Impedire agli editori di caricare qualsiasi altro tipo di file, a parte le immagini (jpg, gif, png). I plugin di questo tipo sono l’ideale perché lavorano silenziosamente in sfondo, senza avere alcun impatto sul tempo di caricamento del sito o sulle attività quotidiane.

Tutto ciò che dovete fare è semplicemente installare e attivare il plugin. Scaricate subito Restrict Uploader.

Divulgazione: I nostri contenuti sono sostenuti dai lettori. Ciò significa che se cliccate su alcuni dei nostri link, potremmo guadagnare una commissione. Vedi come WPBeginner è finanziato , perché è importante e come puoi sostenerci. Ecco il nostro processo editoriale .

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.

Il kit di strumenti WordPress definitivo

Ottenete l'accesso gratuito al nostro kit di strumenti - una raccolta di prodotti e risorse relative a WordPress che ogni professionista dovrebbe avere!

Reader Interactions

9 commentiLascia una risposta

  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. wpbeginner says

    @susan suarez Yes you are correct. This will prevent any malicious entry using the wp-admin to upload stuff using the media uploader…

  3. truecalorie says

    Very handy – thanks for adding this. Would this also help with the security of the plugin? So that if a hacker got in, they couldn’t upload any other type media file?

  4. Debajyoti says

    @wpbeginner You’re right…. I wanted to focus on .JPG, .PNG and .GIF in capital… coz they can’t be uploaded. Some image editors save in capitals…

  5. wpbeginner says

    @Debajyoti Then there would be no point of having this plugin. The whole idea is to keep the editors from uploading any other file type aside from images. We will work on an improvement for this plugin that will let you pick which users to limit the stuff for though :)

  6. wpbeginner says

    @JasonDittmer Yea I love plugin like these myself. Because they don’t require you to do anything. It is for one thing only.

  7. JasonDittmer says

    I was expecting to read about how I had to write a bunch of code to make this work. Thanks for the simple plugin. Nice quick fix!

Lascia una risposta

Grazie per aver scelto di lasciare un commento. Tenga presente che tutti i commenti sono moderati in base alle nostre politica dei commenti e il suo indirizzo e-mail NON sarà pubblicato. Si prega di NON utilizzare parole chiave nel campo del nome. Avremo una conversazione personale e significativa.