• Resolved eurotunes

    (@eurotunes)


    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

    (@k3llanved)

    Hello @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

    (@elenachavdarova)

    Hello @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

    Thread Starter eurotunes

    (@eurotunes)

    Hi Elena,

    Thank you very much. Will do as suggested ??

    Cheers, JJ

    Plugin Author Elena Chavdarova

    (@elenachavdarova)

    You are most welcome, @eurotunes!

    You can drop a quick review 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.