I got this error message when I was installing a plugin: "Unable to locate WordPress Content directory (wp-content)".

I found a solution here: http://wordpress.org/support/topic/cannot-find-content-directory-wp-content

They suggested adding the following code to the wp-config.php file:

if(is_admin()) {
    add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
    define( 'FS_CHMOD_DIR', 0751 );

This solution worked for me. My questions are:

a) What does this code do?

b) If I run into the same error on the production server is it safe to use this code?

Thank you.


2 Answers 2


The first part (add_filter()) tells WordPress to use the direct-write method. The second part (define()) tells WordPress to apply 0751 permissions to any directory it creates. More information here.

I would not consider using the Direct Write method to be safe to use in a live, public, shared-hosting environment.

Also, it might not - and in fact probably won't - work in a shared-hosting environment.

  • Hi Chip, Thank you for the help. I guess I'll use it on my local machine (Mac running WP 3.1.2) and not use it on the production server.
    – Laxmidi
    Commented May 3, 2011 at 21:34

I agree this is a bad idea.Though the permission itself might not be an issue the method is.

751 is a file system permissions (chmod), it means:

User: read/write/execute
Group: read/execute
All: execute


Your Answer

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

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