firdouss.com

Guide: Solving WordPress Update Issue – “Unable To Locate WordPress Plugin Directory”

There has been a failure on the INTERNET
No cats are harmed in the making of this post. I swear!

Ever since WordPress introduced automatic updates in the engine, I have been very excited, as now I don’t have to cringe at every thought of uploading, checking every file is good, and spend a lot of time in the sandbox before finally updating my WordPress installation.

However, depending on your server setup, this automatic updates feature might work beautifully, might not work fully, or might not work at all. Typically, there’s two behavior of the feature:

  • First – it will automatically update your plugins and wordpress installation if wordpress have all the rights, and able to locate where the files are.
  • Second – sometimes it will ask you for your ftp login and password, and will update your plugins and wordpress installation from there

The Problem

By right, this should solve all possible issues pertaining file permissions and location. However, I do not know what’s wrong with my hosting setup, but wordpress will issue me either of these messages upon providing my FTP username and password:

  • Unable To Locate WordPress Plugin Directory
  • Unable To Locate WordPress Content Directory (wp-content)


Irritated, I quickly seek solutions, and I stumble upon Aleksey’s post on this blog on how he manage to solve this issue on his end. I tried this solution and somehow it doesn’t work. WordPress issued me the second error message (see above). It keeps on telling me that it is unable to locate the wp-content directory even though it is obviously there!

So after various searches, I finally found the solution that works for me.

The Solution

The solution is very simple (the one that worked for me). All you need to do is to edit your wp-config.php.

First, open your wp-config.php file and look for this section (usually towards the end of the file):

69
70
71
72
73
74
75
76
/* That's all, stop editing! Happy blogging. */
 
/** WordPress absolute path to the Wordpress directory. */
if ( !defined('ABSPATH') )
	define('ABSPATH', dirname(__FILE__) . '/');
 
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

Now right after the last line, add this:

78
79
80
81
if(is_admin()) {
	add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
	define( 'FS_CHMOD_DIR', 0751 );
}

So your edited wp-config.php codes should now look like this:

69
70
71
72
73
74
75
76
77
78
79
80
81
/* That's all, stop editing! Happy blogging. */
 
/** WordPress absolute path to the Wordpress directory. */
if ( !defined('ABSPATH') )
	define('ABSPATH', dirname(__FILE__) . '/');
 
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
 
if(is_admin()) {
	add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
	define( 'FS_CHMOD_DIR', 0751 );
}

That’s all, save the file, upload (obviously), and try to update your plugins this time. It shouldn’t even ask for any FTP access. It would just update it automatically!

[source]

Related Posts with Thumbnails
Share |

12 Comments

Post Your Comment!