Filenames, file formats, and types Edit

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

Naming files 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 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

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


Tip: Recommended: new-cache.php


Tip: Sometimes okay: new_cache.php


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


Tip: Recommended: wp-settings-1.php


Tip: 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 Referring to files

Top ↑

Referring to filenames 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

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

Top ↑

File interactions File interactions

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

Examples

Warning: Not recommended: Unzip the file.


Warning: Not recommended: Unzip the zip file.


Tip: Recommended: Extract the zip file.

Top ↑

Referring to file types 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

Warning: Not recommended: a .css file


Tip: 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


Warning: Not recommended: a .py file


Tip: 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: