Retrieve the name, path, or link to a randomly chosen file or files in a specified directory.
As of April 2026, Random File is a WordPress file plugin with 80 active installations and a 5/5 rating from 1 reviews. It has been downloaded 29K+ times in total. Requires WordPress 2.8+ and PHP false+. Available on WordPress.org since 2004. Top alternative: Theme Editor.
This plugin provides template tags that allow you to retrieve the name, path (relative or absolute), url, or fully marked-up link to a randomly chosen file or files in a specified directory.
Arguments to the functions permit you to limit what file(s) can be randomly selected based on a given set of file extensions. You can also explicitly specify files that should not be randomly selected.
This functionality can be useful for displaying random images/logos or including text from random files onto your site (writing excerpts, multi-line quotes, etc). Other ideas: random ads, random CSS files, random theme template selection.
Notes:
If you want to actually display the name of the random file, be sure to ‘echo’ the results:
Unless you limit the file search to only include a…
| WordPress | 2.8+ requiredTested up to 6.8.5 |
| PHP | false+ required |
assertRegExp() to assertMatchesRegularExpression() for future PHPUnit 10 compatibility…and 1 more changes
Plugin data sourced from WordPress.org. Analysis and metrics by PluginSift.