File Renaming on Upload

Descrição

Você já teve algum problema ao subir arquivos com acentos e caracteres especiais para o WordPress? Provavelmente a resposta é sim.

Esse plugin vai te ajudar a resolver esse inconveniente renomeando esses arquivos no momento do upload, um pouco antes de serem carregados no WordPress. Esses caracteres inapropriados serão convertidos ou apagados, de forma a não causarem mais problemas.

Além disso, o plugin pode melhorar o SEO do seu site adicionando informações relevantes aos nomes dos arquivos, como o domínio do seu site ou o próprio título do post ao qual seu arquivo foi inserido.

Increase your control over your file names.

✅ Main Features

  • Remove accents and special characters from filenames on upload.
  • Rename files on upload based on post title.
  • Rename files on upload based on the Site URL.
  • Rename files on upload based on the current date.
  • Update file permalink based on file renaming.

🏆 Pro Version

Do you like the free version of this plugin? Imagine what the Premium version can do for you. Take a look at some of its features:

  • Edit filenames and permalinks manually.
  • Update old media.
  • Update media reference in post content on file renaming.
  • Rename filename extension from jpeg to jpg.
  • Update filename on post update.
  • Restrict file renaming by user role.
  • Restrict file renaming by custom post type.
  • Auto-fill file title based on filename structure option.
  • Auto-fill ALT tag.
    • Update alt based on the original filename.
    • Update alt based on the filename structure option.
    • Update alt on filename update.
    • Update alt on new attachment upload.
  • More filename rules:
    • Custom field: Rename files based on custom fields/post meta.
    • Taxonomy: Rename files based on taxonomy.
    • User ID: Rename files based on current user id.
    • User Role: Rename files based on current user role.
    • User Name: Rename files based on user name.
    • Product SKU: Rename files based on product SKU.
    • Post slug: Rename files based on Post slug.
    • Post ID: Rename files based on post ID.
    • Custom String: Rename files based on a custom string.

Imagens de tela

  • Um exemplo de um nome de arquivo já renomeado dentro do Media Library do Wordpress
  • Nos ajustes gerais, configure como será o seu nome de arquivo usando a opção Estrutura do nome do arquivo, onde você possui algumas regras a sua disposição
  • Configura como as regras devem alterar o seu nome de arquivo

Instalação

  1. Suba a pasta ‘file-renaming-on-upload’ para o diretório ‘/wp-content/plugins/’
  2. Ative o plugin através do menu “Plugin” no WordPress
  3. Comece visitando a página de configurações do plugin em settings > File renaming

FAQ

What are the available options provided by this plugin?

For now, you can choose these options:

  • Adicionar a URL do site: Insere “meusite.com” no nome do arquivo. Ex: meusite.com_filename.jpg. Isso é bom para o seu SEO

  • Título do post: Se você está na página de edição de um post chamado “Spiderman vai sair da Marvel” e você sobe um jpg pra esse post, ele vai ser chamado de “spiderman-vai-sair-da-marvel-nome-do-arquivo.jpg”. Essa opção permite que você possa substituir o nome de arquivo pelo título do post ou simplesmente adicionar o título do post ao nome do arquivo

  • Remover caracteres: Remove caracteres do nome do arquivo

  • Data e hora: Você pode adicionar ou substituir o nome de arquivo pela data e hora no formato que desejar

  • Minúsculo: Converte todos os caracteres para minúsculo

  • Remover acentos

  • Atualizar permalink: Quando o nome do arquivo é alterado, você pode alterar também seu permalink, se desejar

Como o plugin funciona?

Renomeando arquivos enquanto estão subindo. Mais especificamente, o plugin usa alguns filters do WordPress que lidam com nomes de arquivos, como o sanitize_file_name, sanitize_file_name_chars ou actions como add_attachment

O que são regras?

Regras são opções para controlar como será o seu nome de arquivo final. Regras são ativadas na aba regras e devem ser inseridas na opção “Estrutura de nome de arquivo”

Para que serve a opção filename structure?

É a opção onde você pode inserir as regras ou outros caracteres quaisquer para configurar como será o seu nome de arquivo

Are there any hooks available?

  • frou_sanitize_file_name Creates custom rules. Take a look on (Can I create a custom rule?)
  • frou_ignored_extensions Ignores extensions. Take a look on (How to ignore extensions programmatically?)

How to ignore extensions programmatically?

You can use the ‘frou_ignored_extensions’ filter to ignore extensions programmatically.
For example, if you’d like to ignore txt, js and zip extensions:

add_filter( 'frou_ignored_extensions', function ( $extensions ) {
    $extensions = array_merge( $extensions, array(
        'txt',
        'js',
        'zip',
    ) );
    return $extensions;
} );

Can I create a custom rule?

Yes. It’s easy.

First, you have to create a custom rule in the filename structure option using curly braces, like {my_custom_rule}. You just have to write it, in any position you want.

Now you can use the filter frou_sanitize_file_name to create a custom function. For example, if you want to put the user id it would be something like this:

add_filter( 'frou_sanitize_file_name', function($filename_infs){
    $filename_infs['structure']['translation']['my_custom_rule'] = get_current_user_id();
    return $filename_infs;
}, 20 );

Como posso contribuir com o desenvolvimento?

Head over to the File Renaming on Upload plugin GitHub Repository to find out how you can pitch in

Avaliações

24 fevereiro, 2023
This is a nice plugin, but I encountered issues on my theme as it broke parts of my site after it renamed some of my theme and plugin files automatically. Took me time to realize it was the culprit 🙂 .
20 julho, 2022
I just wish there was an option to put all words with the first letter in uppercase.
18 março, 2021 1 resposta
Esse plugin é sensacional. Ajuda bastante no envio das imagens. Antes, eu tinha muitos problemas na hora de migrar de servidor, pois alguns fotos, acentuadas, ficavam totalmente inacessíveis na nova hospedagem. Com esse plugin, não tenho mais esse problema. Utilizo o plugin em todos os meus sites. Meus parabéns ao desenvolvedor por ter criado um plugin realmente útil.
25 fevereiro, 2021 3 respostas
I like File Renaming on Upload. Threw all the weird Danish letters I could think of at it, and it performed well. To be completely nitty-gritty, the letter "Å" translates into "aa" and not just "a", and a similar limitation goes for the letter "Ø", but I'm good - the most important thing is to avoid those horrible urls which characters like space results in. This plugin has more filters and rules like the typical file name sanitizer - that's a plus. Large premium version notice has been reduced in the latest version, and is no longer obtrusive. Nice. Oh - almost forgot. Tested on a WordPress 5.7 multisite installation running php 8.0. Yeah, that's right. It works perfectly with the latest version of PHP! Good job.
Leia todas as 38 avaliações

Colaboradores e desenvolvedores

“File Renaming on Upload” é um software com código aberto. As seguintes pessoas contribuíram para este plugin.

Colaboradores

“File Renaming on Upload” foi traduzido para 2 localizações. Agradecemos aos tradutores por suas contribuições.

Traduzir “File Renaming on Upload” para o seu idioma.

Interessado no desenvolvimento?

Navegue pelo código, dê uma olhada no repositório SVN ou assine o registro de desenvolvimento via RSS.

Registro de alterações

2.5.3 – 2023/05/18

  • Fix – PHP warning: Trying to access array offset on value of type int.

2.5.2 – 2023/05/18

  • Fix – Fields are not getting sanitized properly.
  • Dev – Improve separator logic.
  • Tested up to: 6.2.

2.5.1 – 2023/02/01

  • Tested up to: 6.1.
  • Move to WPFactory.

2.5.0 – 2022/08/12

  • Tested up to: 6.0.

2.4.9 – 2022/02/21

  • Improve “Convert characters to dash” option.
  • Tested up to: 5.9.

2.4.8 – 2021/10/14

  • Add “Max length” option for “Filename structure”.

2.4.7 – 2021/09/20

  • Fix – Both plugins can’t be active at the same time.
  • Improve composer setup.
  • Improve readme.
  • Tested up to: 5.8.

2.4.6 – 2021/07/02

  • Fix timezone warning from datetime rule.
  • Add frou_current_media_id filter.
  • Add get_current_media_id() function.

2.4.5 – 2021/06/07

  • Save original filename on new attachment.
  • Update promoting notice.
  • Improve coding standards.

2.4.4 – 2021/05/24

  • Fix truncate option when used along with post title conversion.
  • Change deploy script.

2.4.3 – 2021/03/15

  • Fix truncate option by removing max limit.
  • Tested up to: 5.7.

2.4.2 – 2021/02/25

  • Add “Accents conversion method” option.
  • Add transliterator_transliterate function as an option to convert characters.

2.4.1 – 2021/02/21

  • Tested up to: 5.6.
  • Add Gutenberg title fix option.
  • Fix composer autoload call.
  • Update readme.

2.4.0 – 2020/12/07

  • Prevent dots from extension being converted to dash in “Rules > Filename > Convert”.
  • Add new_extension parameter on frou_sanitize_file_name hook.
  • Add multiselect field on admin.
  • Tested up to: 5.5.
  • Add log to ignored file extensions.

2.3.9 – 2020/06/18

  • Disable renaming when using WooCommerce Export Products.
  • Create ‘frou_renaming_validation’ filter.
  • Fix blocking by extension.
  • Fix wrong string
  • Improve datetime option
  • Tested up to: 5.4

2.3.8 – 2019/11/26

  • Fix posttitle rule removing spaces from titles

2.3.7 – 2019/11/17

  • Fix ‘posttitle’ rule when title is formed with non latin characters.

2.3.6 – 2019/11/15

  • Fix ‘posttitle’ rule after WordPress 5.3

2.3.5 – 2019/11/13

  • Fix ‘Parameter must be an array or an object that implements Countable’
  • Tested up to: 5.3

2.3.4 – 2019/04/12

  • Fix warning on ‘upgrader_process_complete’ hook where $options[‘plugins’] are not always present

2.3.3 – 2019/04/11

  • Tested up to: 5.1

2.3.2 – 2019/02/10

  • Improve Ignored Messages field
  • Add sounds section on settings
  • Improve premium notices on admin
  • Add default ignored messages preventing empty popups
  • Improve readme

2.3.1 – 2019/01/23

  • Add filter ‘frou_filename_allowed’
  • Tested up to: 5.0

2.3.0 – 2018/11/02

  • Add more names to ignore filenames option regarding visual composer
  • Add ‘frou_after_sanitize_file_name’ filter
  • Add option to not rename files without extension trying to prevent third party compatibility

2.2.9 – 2018/07/27

  • Check if rules exist before convert filename
  • Add more names to ignore filenames option regarding visual composer

2.2.8 – 2018/04/20

  • Check if permalink option is enabled on add_attachment function

2.2.7 – 2018/03/30

  • Make it compatible with Nextgen gallery plugin

2.2.6 – 2018/03/26

  • Update translation file
  • Add persian translation
  • Config auto deploy with travis
  • Add wp.org assets on github

2.2.5 – 2018/01/30

  • Fix empty function

2.2.4 – 2018/01/26

  • Add translation to some missing strings
  • Add option to truncate filename

2.2.3 – 2017/11/27

  • Fix notice checking
  • Replace “install_plugins” permission by “edit_users”
  • Tested up to WordPress 4.9

2.2.2

  • Update pot file
  • Add strings to translation

2.2.1

  • Set transient on update

2.2.0

  • Open tab if hash is present
  • Improve settings api
  • Create notice asking for review
  • Create notice talking about the pro version
  • Improve plugin’s description

2.1.9

  • Create a filter to get the parent post id (frou_parent_post_id)

2.1.8

  • Create a filter to ignore filename extensions (frou_ignored_extensions)

2.1.7

  • Improve function to get post title, even with unsaved posts

2.1.6

  • Add new filter ‘frou_admin_sections’ to filter admin sections
  • Improve settings api
  • Update tested up to
  • Restrict settings to administrators only

2.1.5

  • Add new option to convert characters to dash

2.1.4

  • Fix conflict on WeDevs settings API libraries

2.1.3

  • Update Settings API class

2.1.2

  • Start the plugin after plugins_loaded hook
  • Fix github link
  • Improve readme

2.1.1

  • Add new option to ignore filenames
  • Fix conflict with sitemap.xml generated by All in one SEO pack

2.1.0

  • Add new option to remove non ASCII characters

2.0.8

  • Solve more conflicts with github updater plugin

2.0.7

  • Fix datetime option fatal error on update() boolean

2.0.6

  • Solves more conflicts with github updater plugin

2.0.5

  • Ignores more basenames (‘option_page’, ‘action’, ‘wpnonce’, ‘wp_http_referer’, ‘github_updater_repo’, ‘github_updater_branch’, ‘github_updater_api’, ‘github_access_token’, ‘bitbucket_username’, ‘bitbucket_password’, ‘gitlab_access_token’, ‘submit’, ‘db_version’, ‘github_updater_install_repo’) when there is no extension provided to solve more conflicts with github-updater plugin

2.0.4

  • Ignores some basenames (‘path’, ‘scheme’, ‘host’, ‘owner’, ‘repo’, ‘owner_repo’, ‘base_uri’, ‘uri’) when there is no extension provided. It solves conflicts with github-updater plugin

2.0.3

  • Melhorar descrição
  • Adicionar opção para ignorar algumas extensões de arquivos
  • Adicionar nova imagem
  • Remover portugês e alemão dos pacotes de tradução da pasta “languages”

2.0.2

  • Melhorar a tradução em português
  • Adicionar tradução em Alemão

2.0.1

  • Consertar um bug do autoloader em ambientes Linux

2.0.0

  • Recriar o plugin com novas opções

1.3

  • Consertar bug onde a URL do site deveria ser a url da home

1.2

  • Adicionada uma opção para renomear arquivos baseados no título do post
  • Consertado um bug em que algumas strings não eram removidas do endereço do site

1.1

  • Adicionada uma opção para remover caracteres da url

1.0.1

  • Classe Admin Page renomeada

1.0

  • Release inicial