Title: My Plugin Safety doubt
Last modified: April 10, 2019

---

# My Plugin Safety doubt

 *  [antonop4u](https://wordpress.org/support/users/antonop4u/)
 * (@antonop4u)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/my-plugin-safety-doubt/)
 * Hi,
    I’m developing a new plugin; in the fronthand, i want to check if the plugin
   is active by using this code:
 *     ```
       <?php
       include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
       if(is_plugin_active( 'plugin-directory/plugin.php' ) ){
         do-something();
       }?>
       ```
   
 * Does the first line (include_once …. ) allow the user to bypass the following
   security line that WordPress suggest to set at the beginning of every php plugin
   file?
 * <?php if ( ! defined( ‘ABSPATH’ ) ) exit;?>
 * if yes, how can I check in a secure way “in the fronthand” if a plugin is active?
    -  This topic was modified 7 years, 1 month ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
      Reason: Formatting

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Richard van Denderen](https://wordpress.org/support/users/rdd/)
 * (@rdd)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/my-plugin-safety-doubt/#post-11411681)
 * I think this is the documentation you’re looking for:
 * [https://developer.wordpress.org/reference/functions/is_plugin_active/](https://developer.wordpress.org/reference/functions/is_plugin_active/)
 * It’s describing the exact thing you are doing also with some code examples.
 *  Thread Starter [antonop4u](https://wordpress.org/support/users/antonop4u/)
 * (@antonop4u)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/my-plugin-safety-doubt/#post-11412090)
 * Thank you very much for your answer, but that’s where I’ve got the idea in the
   first place; on the first of the user contribution notes; I just wonder if it’s
   safe. In few words I don’t know if it’s not going to “defined( ‘ABSPATH’ )” for
   all the plugin files:
 * <?php if ( ! defined( ‘ABSPATH’ ) ) exit;?>
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/my-plugin-safety-doubt/#post-11413773)
 * Including a PHP file causes the entire file to be parsed, so yes it’s an effective
   deterrent. You can prove it to yourself by checking for an undefined constant
   like `if ( ! defined( 'FOOBAR' ) ) exit;` instead. Subsequent page requests will
   fail to load due the the `exit` statement being executed.
 *  Thread Starter [antonop4u](https://wordpress.org/support/users/antonop4u/)
 * (@antonop4u)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/my-plugin-safety-doubt/#post-11414188)
 * Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘My Plugin Safety doubt’ is closed to new replies.

## Tags

 * [ABSPATH](https://wordpress.org/support/topic-tag/abspath/)
 * [development](https://wordpress.org/support/topic-tag/development/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 4 replies
 * 3 participants
 * Last reply from: [antonop4u](https://wordpress.org/support/users/antonop4u/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/my-plugin-safety-doubt/#post-11414188)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
