0

I want to write this code on my custom plugin main file to prevent to access folder/files.

define( 'FTEC_DIR', dirname( __FILE__ ) );
9
  • Could you please provide more information about what you're trying to achieve? Also your question doesn't contain any. Dec 7, 2016 at 12:14
  • i made a custom plugin but there are one problem when we are put URL of plugin that are show all files and folder so how can i prevent this Dec 7, 2016 at 12:28
  • Is this is related to web server setting not to allow visiting files in wp-content, wp-admin, wp-include?
    – prosti
    Dec 7, 2016 at 13:06
  • @prosti So there are not any options/ function to prevent this Dec 7, 2016 at 13:07
  • @prosti I also check another plugins that are not allow to direct access any files/folder Dec 7, 2016 at 13:09

1 Answer 1

1

Well. If I'm not wrong, you are looking for a way to hide what files are in your plugin directory?

Just keep an index.php file in your plugin directory.

And as an extra layer of security, add this code at the very beginning of all of your PHP files-

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
    die();
}
2
  • I want to prevent my plugin file and i also want to write code in plugin code file Dec 12, 2016 at 6:25
  • can you elaborate?
    – mukto90
    Dec 12, 2016 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.