Title: If File Exists
Author: Scott Reilly
Published: <strong>جون 12, 2009</strong>
Last modified: اپریل 18, 2025

---

پلگ انز تلاش کریں

![](https://ps.w.org/if-file-exists/assets/banner-772x250.png?rev=829848)

یہ پلگ ان **ورڈپریس کے تازہ ترین 3 ریلیزوں کے ساتھ ٹیسٹ نہیں کیا گیا ہے**۔ اب یہ
برقرار نہیں رکھا جا سکتا یا معاونت نہیں کی جا سکتی اور اس کو ورڈپریس کے تازہ ترین
ورژنز کے ساتھ استعمال کیے جانے پر مطابقت کے مسائل ہو سکتے ہیں۔

![](https://ps.w.org/if-file-exists/assets/icon-128x128.png?rev=976276)

# If File Exists

 منجانب [Scott Reilly](https://profiles.wordpress.org/coffee2code/)

[ڈاؤن لوڈ کریں](https://downloads.wordpress.org/plugin/if-file-exists.2.4.zip)

 * [تفصیلات](https://ur.wordpress.org/plugins/if-file-exists/#description)
 * [جائزے](https://ur.wordpress.org/plugins/if-file-exists/#reviews)
 *  [انسٹالیشن](https://ur.wordpress.org/plugins/if-file-exists/#installation)
 * [ڈیولپمنٹ](https://ur.wordpress.org/plugins/if-file-exists/#developers)

 [معاونت](https://wordpress.org/support/plugin/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 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 `$echo` argument 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](https://coffee2code.com/wp-plugins/if-file-exists/) | [Plugin Directory Page](https://wordpress.org/plugins/if-file-exists/)
| [GitHub](https://github.com/coffee2code/if-file-exists/) | [Author Homepage](https://coffee2code.com)

### Developer Documentation

Developer documentation can be found in [DEVELOPER-DOCS.md](https://github.com/coffee2code/if-file-exists/blob/master/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
   invoke `c2c_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 invoke `c2c_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 invoke `c2c_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.

## انسٹالیشن

 1. Install via the built-in WordPress plugin installer. Or install the plugin code
    inside the plugins directory for your site (typically `/wp-content/plugins/`).
 2. Activate the plugin through the ‘Plugins’ admin menu in WordPress
 3. In one or more of your templates, utilize one of the template tags provided by 
    this plugin (see examples)

## جائزے

![](https://secure.gravatar.com/avatar/d4b37471aa6375e4c7c62fb4fcfccd315cbfb4866b133065677a6967c160c1a6?
s=60&d=retro&r=g)

### 󠀁[Nice plugin, does exactly what it says](https://wordpress.org/support/topic/nice-plugin-does-exactly-what-it-says/)󠁿

 [grn](https://profiles.wordpress.org/grn/) ستمبر 3, 2016

Very helpful. Saved time trying to get the file functions to work. Thanks for making
this available.

 [ تمام 1 جائزے پڑھیں ](https://wordpress.org/support/plugin/if-file-exists/reviews/)

## شراکت دار اور ڈیویلپرز

“If File Exists” اوپن سورس سافٹ ویئر ہے۔ مندرجہ ذیل لوگوں نے اس پلگ ان میں حصہ لیا:

شراکت دار

 *   [ Scott Reilly ](https://profiles.wordpress.org/coffee2code/)

“If File Exists” کا 1 زبان میں ترجمہ کیا گیا ہے۔ تعاون کے لیے [مترجمین](https://translate.wordpress.org/projects/wp-plugins/if-file-exists/contributors)
کا شکریہ۔

[“If File Exists” کا اپنی زبان میں ترجمہ کریں۔](https://translate.wordpress.org/projects/wp-plugins/if-file-exists)

### ڈویلپمینٹ میں دلچسپی ہے؟

[کوڈ براؤز کریں](https://plugins.trac.wordpress.org/browser/if-file-exists/)، [ایس این وی ریپوزیٹری](https://plugins.svn.wordpress.org/if-file-exists/)
کو چیک کریں یا [ڈویلپمینٹ لاگ](https://plugins.trac.wordpress.org/log/if-file-exists/)
کو سبسکرائب کریں بذریعہ [آر ایس ایس](https://plugins.trac.wordpress.org/log/if-file-exists/?limit=100&mode=stop_on_copy&format=rss)۔

## چینج لاگ

#### 2.4 (2025-04-18)

 * New: Add ‘%file_size%’ and ‘%file_size_bytes%’ as additional substitution tags
 * Change: Escape `$format` and `$show_if_not_exists` values 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 `.gitignore` file
 * 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.json` for PHPUnit Polyfill dependency
    - Change: In bootstrap, store path to plugin directory in a constant

#### 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](https://github.com/coffee2code/if-file-exists/blob/master/CHANGELOG.md)._

## میٹا

 *  Version **2.4**
 *  Last updated **1 سال پہلے**
 *  Active installations **10+**
 *  WordPress version ** 2.7 یا اس سے جدید **
 *  Tested up to **6.8.10**
 *  Languages
 * [English (US)](https://wordpress.org/plugins/if-file-exists/) اور [German](https://de.wordpress.org/plugins/if-file-exists/).
 *  [اپنی زبان میں ترجمہ کریں](https://translate.wordpress.org/projects/wp-plugins/if-file-exists)
 * Tags
 * [coffee2code](https://ur.wordpress.org/plugins/tags/coffee2code/)[existence](https://ur.wordpress.org/plugins/tags/existence/)
   [file](https://ur.wordpress.org/plugins/tags/file/)[filesystem](https://ur.wordpress.org/plugins/tags/filesystem/)
 *  [اعلی درجے کا منظر](https://ur.wordpress.org/plugins/if-file-exists/advanced/)

## درجہ بندیاں

 5 out of 5 stars.

 *  [  1 5-star review     ](https://wordpress.org/support/plugin/if-file-exists/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/if-file-exists/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/if-file-exists/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/if-file-exists/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/if-file-exists/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/if-file-exists/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/if-file-exists/reviews/)

## شراکت دار

 *   [ Scott Reilly ](https://profiles.wordpress.org/coffee2code/)

## معاونت

کچھ کہنا ہے؟ مدد چاہیے؟

 [معاونتی فورم دیکھیں](https://wordpress.org/support/plugin/if-file-exists/)

## عطیہ دیں

کیا آپ اس پلگ ان کی ترقی میں معاونت کرنا چاہتے ہیں؟

 [ اس پلگ ان کو عطیہ دیں ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ARCFJ9TX3522)