If File Exists
This plugin provides the functions c2c_if_file_exists(), c2c_if_theme_file_exists(), c2c_if_plugin_file_exists() that check if a file exists and either return true/false or display a string containing information about…
Consider an alternative
If File Exists shows warning signs in 2026 — compare the alternatives below before installing. It runs on 30+ sites, is rated 5/5 and was last updated 2 years ago, and scores 40/100 on our health check.
- Small user base (30+ active installs)
- Very few reviews so far
- No update in over a year
- Only tested up to WordPress 6.8 (latest is 7.1)
How does it stack up?
Side-by-side on installs, updates, ratings & supportDaily downloads
Download spikes usually follow a new release — each site that auto-updates counts as a download.
Rankings
Where If File Exists stands todayWordPress.org search rankings
Live position in the plugin search, top 100| Keyword | Position |
|---|---|
| coffee2code | #11 |
| existence | #21 |
| exists | #14 |
| file | >100 |
| filesystem | #36 |
Version adoption
Share of active sites per release.
Rating breakdown
★★★★★★★★★★ 5 from 1 reviews
About If File Exists
From the official readme · v2.4Description
This plugin provides the functions c2c_if_file_exists(), c2c_if_theme_file_exists(), c2c_if_plugin_file_exists() that check if a file exists and either return true/false or display a string containing information about the file.
- If a format string is not passed to it, the functions returns a simple boolean (true or false) indicating if the specified file exists.
- Otherwise, the format string provided to it will be used to construct a response string, which can be customized to display information about the file (such as directory, extension, name, path, size, or url). If the
$echoargument is true, that string is displayed on the page. Regardless of the value of$echo, the response string is returned by the function.
By default, c2c_if_file_exists() assumes you are looking for the file relative to the default WordPress upload directory. If you wish to search another directory, specify it as the $dir argument. c2c_if_theme_file_exists() assumes you are looking for a file relative to the currently active theme’s home directory. c2c_if_plugin_file_exists() assumes you are looking for a file relative to the directory that contains WordPress plugins.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Developer Documentation
Developer documentation can be found in DEVELOPER-DOCS.md. That documentation covers the template tags and hooks provided by the plugin.
As an overview, these are the template tags provided by the plugin:
c2c_if_file_exists(): Checks if a file exists and returns true/false or displays a string containing information about the file.c2c_if_plugin_file_exists(): Checks if a file exists (relative to the plugins directory) and returns true/false or displays a string containing information about the file.c2c_if_theme_file_exists(): Checks if a file exists (relative to the current theme’s directory) and returns true/false or displays a string containing information about the file. If the current theme is a child theme, then the function will check if the file exists first in the child theme’s directory, and if not there, then it will check the parent theme’s directory.
These are the hooks provided by the plugin:
c2c_if_file_exists: Filter that allows use of an alternative approach to safely invokec2c_if_file_exists()in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.c2c_if_plugin_file_exists: Filter that allows use of an alternative approach to safely invokec2c_if_plugin_file_exists()in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.c2c_if_theme_file_exists: Filter that allows use of an alternative approach to safely invokec2c_if_theme_file_exists()in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.
Installation
- Install via the built-in WordPress plugin installer. Or install the plugin code inside the plugins directory for your site (typically
/wp-content/plugins/). - Activate the plugin through the ‘Plugins’ admin menu in WordPress
- In one or more of your templates, utilize one of the template tags provided by this plugin (see examples)
Changelog
Minor update: added '%file_size%' and '%file_size_bytes%' substitution tags, escaped output before display to prevent unsafe markup, noted compatibility through WP 6.8+ and PHP 8.3+, and updated copyright date (2025)
2.4 (2025-04-18)
- New: Add ‘%file_size%’ and ‘%file_size_bytes%’ as additional substitution tags
- Change: Escape
$formatand$show_if_not_existsvalues prior to display to omit unsafe markup - Change: Discontinue unnecessary explicit loading of textdomain
- Change: Note compatibility through WP 6.8+
- Change: Note compatibility through PHP 8.3+
- Change: Update copyright date (2025)
- Unit tests:
- Change: Change test class name to match plugin name
2.3.2 (2024-08-02)
- Change: Note compatibility through WP 6.6+
- Change: Update copyright date (2024)
- New: Add
.gitignorefile - Change: Remove development and testing-related files from release packaging
- Unit tests:
- Hardening: Prevent direct web access to
bootstrap.php - Allow tests to run against current versions of WordPress
- New: Add
composer.jsonfor PHPUnit Polyfill dependency - Change: In bootstrap, store path to plugin directory in a constant
- Hardening: Prevent direct web access to
2.3.1 (2023-05-18)
- Change: Note compatibility through WP 6.3+
- Change: Update copyright date (2023)
- New: Add a potential TODO item
Full changelog is available in CHANGELOG.md.
For developers
Is this your plugin? Show off the numbers.
Add a live badge to your site, docs or GitHub README. It updates on its own — no account needed.
Best If File Exists alternatives
All coffee2code plugins →FAQ
If File Exists: quick answers
Straight answers, pulled from live WordPress.org data.
Live data from WordPress.org · checked Oct 21, 2026
Is If File Exists free?
Yes. If File Exists is free to download and use from the official WordPress.org plugin directory.
Is If File Exists safe to use in 2026?
If File Exists shows warning signs in 2026 — compare the alternatives below before installing. It runs on 30+ sites, is rated 5/5 and was last updated 2 years ago, and scores 40/100 on our health check.
How many websites use If File Exists?
If File Exists is active on 30+ WordPress websites and has been downloaded 13,560 times since it launched in June 2009. It was downloaded 202 times in the last 30 days.
Does If File Exists work with WordPress 7.1?
If File Exists is officially tested up to WordPress 6.8.11, while the latest release is 7.1.3. It may still work, but try it on a staging site first.
When was If File Exists last updated?
The latest version, 2.4, was released on April 18, 2025 (2 years ago).
Who makes If File Exists?
If File Exists is developed and maintained by Scott Reilly.
What are the best alternatives to If File Exists?
The most popular alternatives to If File Exists are Disable Search (30K+ installs), Configure SMTP (6K+ installs) and One Click Close Comments (5K+ installs).
Powered by PageForge
Want thousands of pages that rank like these? Build them in an afternoon.
This directory runs on the same engine as PageForge. Turn any spreadsheet, CSV or API into thousands of fast, SEO-ready WordPress pages — with schema, internal links and AI-written copy baked in.
- CSV, Google Sheets & API data sources
- AI content, schema & internal links per page
- Works with Elementor, Gutenberg, Yoast & Rank Math
- Free on WordPress.org — no credit card