Title: Whitelisting a script
Last modified: September 1, 2022

---

# Whitelisting a script

 *  Resolved [eurotunes](https://wordpress.org/support/users/eurotunes/)
 * (@eurotunes)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/whitelisting-a-script-2/)
 * Hi there,
 * I need to whitelist a php file which is located in the directory of a plugin.
 * You provide a script example for the wp_content folder. Will this also work in
   my situation, eg. does it scan the whole wp_content folder and sub-folders for
   this file or do I need to list the full path, like ../wp_content/plugins/plugin?
 * Thanks JJ

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

 *  Plugin Support [Simeon Boev](https://wordpress.org/support/users/k3llanved/)
 * (@k3llanved)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/whitelisting-a-script-2/#post-15971028)
 * Hello [@eurotunes](https://wordpress.org/support/users/eurotunes/),
 * As far as I understand you want to know if the feature “Lock and Protect System
   Folders” can allow a specific file to be accessed even if it’s located under 
   the wp-content folder. At the moment there is no special filter to allow a PHP
   script to be accessible directly from one of the plugin’s folders. Consider moving
   the script directly to the wp-content folder and then set a custom exclude rule
   for the file in question:
 *     ```
       add_filter( 'sgs_whitelist_wp_content' , 'whitelist_file_in_wp_content' );
       function whitelist_file_in_wp_content( $whitelist ) {
           $whitelist[] = 'file_name.php';
           $whitelist[] = 'another_file_name.php';
   
           return $whitelist;
       }
       ```
   
 * Best Regards,
    Simeon Boev
 *  Plugin Author [Elena Chavdarova](https://wordpress.org/support/users/elenachavdarova/)
 * (@elenachavdarova)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/whitelisting-a-script-2/#post-15972946)
 * Hello [@eurotunes](https://wordpress.org/support/users/eurotunes/),
 * There is no need to move the file into the wp-content directory.
 * The rules excluding it are placed in .htaccess file, so the exclude will be applied
   for the whole wp-content directory recursively.
 * There is no need to provide full path to the file as well. Simply the file name
   will be enough.
 * You need to simply add the filter to your theme functions.php file and the rules
   will do the rest.
 * Best Regards,
    Elena
    -  This reply was modified 3 years, 9 months ago by [Elena Chavdarova](https://wordpress.org/support/users/elenachavdarova/).
 *  Thread Starter [eurotunes](https://wordpress.org/support/users/eurotunes/)
 * (@eurotunes)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/whitelisting-a-script-2/#post-15974189)
 * Hi Elena,
 * Thank you very much. Will do as suggested 🙂
 * Cheers, JJ
 *  Plugin Author [Elena Chavdarova](https://wordpress.org/support/users/elenachavdarova/)
 * (@elenachavdarova)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/whitelisting-a-script-2/#post-15978779)
 * You are most welcome, [@eurotunes](https://wordpress.org/support/users/eurotunes/)!
 * You can drop a [quick review](https://wordpress.org/support/plugin/sg-security/reviews/#new-post)
   for the plugin if you have the time, that would be highly appreciated 🙂
 * Best Regards,
    Elena

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

The topic ‘Whitelisting a script’ is closed to new replies.

 * ![](https://ps.w.org/sg-security/assets/icon-256x256.gif?rev=2971855)
 * [Security Optimizer - The All-In-One Protection Plugin](https://wordpress.org/plugins/sg-security/)
 * [Support Threads](https://wordpress.org/support/plugin/sg-security/)
 * [Active Topics](https://wordpress.org/support/plugin/sg-security/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sg-security/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sg-security/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Elena Chavdarova](https://wordpress.org/support/users/elenachavdarova/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/whitelisting-a-script-2/#post-15978779)
 * Status: resolved