Filenames, file formats, and types Edit

Highlight: Use all-lowercase filenames and separate words in filenames with hyphens.

Naming files

Use lowercase file, folder, and directory names. In general, separate words in filenames with hyphens, not underscores. Use standard ASCII alphanumeric characters in file, folder, and directory names.

Top ↑

Consistent naming

If you’re creating and naming new files where other files have a different naming convention, see if the other files and folders can be renamed with the aforementioned guidelines. If you cannot change existing filenames, it is acceptable to use underscores or other naming conventions that are in use, to remain consistent with the existing style.

For example, if the directory already has files named as theme_1.php, theme_2.php, and theme_3.php, it’s acceptable to name the new file as theme_4.php instead of theme-4.php.

Examples

Not recommended: newcache.php, newCache.php, new-caché.php

Recommended: new-cache.php

Sometimes okay: new_cache.php

Not recommended: wpsettings1.php, wpSettings1.php, WPSettings1.php, wp-settings1.php, wpsettings-1.php

Recommended: wp-settings-1.php

Sometimes okay: wp_settings_1.php

It’s acceptable to have some inconsistency in file and folder names if it can’t be avoided otherwise. There might be predefined design and style guidelines or undocumented guidelines that are already in use. Sometimes, file naming can also be automated by the product. In those cases, it’s okay to make exceptions for those files.

Top ↑

Referring to files

Top ↑

Referring to filenames

While referring to a file, follow these guidelines:

  • Use code font.
  • Use the exact name of the file, even if it doesn’t follow the file naming guidelines.
  • If content from the file is included in the page, follow the code example guidelines and precede the code sample or content with an introductory statement that states the filename.

Example

Recommended: In the following styles.css file, set the opacity to 0.75:

Top ↑

File interactions

While writing about file interactions, don’t use the file types as a verb.

Examples

Not recommended: Unzip the file.

Not recommended: Unzip the zip file.

Recommended: Extract the zip file.

Top ↑

Referring to file types

Use the formal file type instead of the file extension while referring to file types. Many file types are expressed in uppercase, as they are acronyms or initialisms.

Examples

Not recommended: a .css file

Recommended: a CSSCSS CSS is an acronym for cascading style sheets. This is what controls the design or look and feel of a site. file

Not recommended: a .py file

Recommended: a Python file

The following table lists filename extensions and the corresponding file type names to use:

Extension File type name
.css CSS file
.csv CSV file
.dmg DMG file
.exe executable file
.gif GIF file
.html HTML file
.img disk image file
.jar JAR file
.java Java file
.jpg, .jpeg JPEG file
.js JavaScript file
.json JSON file
.md Markdown file
.mp3 MP3 file
.mp4 MP4 file/MPEG-4 file
.pdf PDF file
.php PHP file
.png PNG file
.ps PowerShell file
.py Python file
.rar RAR file
.sh Bash file
.sql SQL file
.svg SVG file
.tar tar file
.txt text file
.wav WAV file
.xml XML file
.yaml, .yml YAML file
.zip zip file

Last updated: