---
title: File Renaming Hooks and Filters Reference
description: "Developer reference for WordPress file renaming on upload: filters and actions, with an example that ignores extra extensions."
url: "https://wpfactory.com/docs/file-renaming-hooks-and-filters/"
updated: "2026-09-27"
category: Developers
---

# File Renaming Hooks and Filters Reference

[Rename Media Files: Improve Your WordPress SEO](https://wpfactory.com/item/file-renaming-on-upload-wordpress-plugin/) exposes a set of filters and actions so you can extend how uploaded files are renamed. This reference lists the hooks available in Rename Media Files and what each one is for. All hooks use the `frou_` prefix.

### Filters

| Hook | Type | Signature | Description |
| --- | --- | --- | --- |
| `frou_sanitize_file_name` | Filter | `array $filename_infs` | The main hook for building custom rules. Set `$filename_infs['structure']['translation']['{yourtoken}']` to fill a token you placed in the Filename structure field. |
| `frou_ignored_extensions` | Filter | `array $extensions` | Add file extensions that should be ignored during renaming, in code rather than in the settings. |
| `frou_structure_rules` | Filter | `array $rules` | The list of enabled structure rule tokens used to build the filename. |
| `frou_structure_rules_list` | Filter | `string $html` | The HTML list of available rules shown under the Filename structure field. |
| `frou_filename_allowed` | Filter | `bool $allowed, string $filename, array $infs` | Allow or deny renaming a given file. Return `false` to skip renaming for that file. |
| `frou_get_media_post_title` | Filter | `string $title` | Override the post title used by the `{posttitle}` rule. |
| `frou_get_media_post_slug` | Filter | `string $slug` | Override the post slug used by the `{postslug}` rule. |
| `frou_current_media_id` | Filter | `int $media_id` | Resolve the current media (attachment) ID being processed. |
| `frou_current_media_post_id` | Filter | `int $post_id` | Resolve the parent post ID the media is attached to. |
| `frou_after_sanitize_file_name` | Filter | `array $filename_infs` | Runs after the filename has been sanitized, for final adjustments. |
| `frou_admin_sections` | Filter | `array $sections` | Add or modify the settings tabs (sections). |
| `frou_fields_{section_id}` | Filter | `array $fields` | Add fields to a specific settings section, where `{section_id}` is the section identifier. |
| `frou_renaming_validation` | Filter | `bool $valid` | Validation gate applied before a file is renamed. |
| `frou_queue_filename_update_validation` | Filter | `bool $valid` | Validation gate applied when queuing a filename update. |
| `frou_bkg_process_filename_allowed` | Filter | `bool $allowed` | Validation gate applied by the background process before renaming. |
| `frou_ignore_update_if_name_matches` | Filter | `bool $ignore` | Skip an update when the resulting name matches the existing one. |
| `frou_post_id_query_string_params` | Filter | `array $params` | Query string parameters used to resolve the current post ID. |
| `frou_filename_update_cmb_post_types` | Filter | `array $post_types` | Post types on which the filename update metabox appears. |
| `frou_is_free_version` | Filter | `bool $is_free` | Whether the free version is running. |
| `frou_cmb_hookup` | Filter | `mixed $hookup` | Adjust the metabox hookup used on the media edit screen. |

### Actions

| Hook | Type | Description |
| --- | --- | --- |
| `frou_update_attachment_filename_before` | Action | Fires before an attachment's filename is updated. |
| `frou_update_attachment_filename_after` | Action | Fires after an attachment's filename has been updated. |
| `frou_update_post_before` | Action | Fires before the related post is updated. |
| `frou_update_post_after` | Action | Fires after the related post has been updated. |
| `frou_update_attachment_permalink` | Action | Fires when an attachment's permalink is updated. |
| `frou_admin_notices` | Action | Fires where the plugin's admin notices are output. |
| `frou_media_cmb_fields` | Action | Fires where the media metabox fields are rendered. |

### Example: ignore extra file extensions

Use `frou_ignored_extensions` to add extensions that should never be renamed:

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

### Need a hand?

Our team answers every ticket on the [Rename Media Files support forum](https://wpfactory.com/support/item/file-renaming-on-upload-wordpress-plugin/).

Related articles

- [File Renaming Settings Reference](https://wpfactory.com/docs/file-renaming-settings-reference/)
- [How to Create a Custom File Renaming Rule](https://wpfactory.com/docs/create-custom-file-renaming-rule/)
- [How to Restrict File Renaming by User Role or Post Type](https://wpfactory.com/docs/restrict-file-renaming-by-user-role-or-post-type/)
- [File Renaming on Upload Pro: Troubleshooting Tips](https://wpfactory.com/docs/pro-troubleshooting-tips/)
- [Advanced File Renaming: Managing Exceptions in Pro](https://wpfactory.com/docs/advance/)
