{"id":4267,"date":"2015-03-10T20:13:48","date_gmt":"2015-03-10T12:13:48","guid":{"rendered":"http:\/\/rmohan.com\/?p=4267"},"modified":"2015-03-10T20:13:48","modified_gmt":"2015-03-10T12:13:48","slug":"solution-to-fix-wordpress-update-failure-issue","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4267","title":{"rendered":"Solution to fix WordPress update failure issue"},"content":{"rendered":"<p>I was having problem while updating one of my plugin weeks ago, telling me that<\/p>\n<p>Could not create directory. \/home\/<>\/public_html\/wp-content\/plugins\/download-manager<br \/>\n Plugin install failed.<\/p>\n<p>or<\/p>\n<p>Unable to locate WordPress Content directory (wp-content).<\/p>\n<p>By then, I turned to Google for solutions, however, tried every way I got, such as:<br \/>\n\u20221. Remove the plugin and re-install it.<br \/>\n\u20222. Change permission of wp-contents direcotry and sub-directories to 777<br \/>\n\u20223. Change the ftp accout of wp-config.php<\/p>\n<p>But none of them can fix my problem, so I have to upload the plugin mannually, and got it fixed.<\/p>\n<p>Days ago, WordPress 4.1.1 is released, and a bunch of plugin updated. When I tried to update them turned out none of them can be updated.<\/p>\n<p>So I can not avoid it now.<\/p>\n<p>Obviously, this issue is permission relevant. After digged more into the issue, finnally got a solution for it, and this is the antidote, fix it by adding the following code to the end of your wp-config.php<\/p>\n<p>if(is_admin())<br \/>\n{<br \/>\n    add_filter(&#8216;filesystem_method&#8217;, create_function(&#8216;$a&#8217;, &#8216;return &#8220;direct&#8221;;&#8217; ));<br \/>\n    define( &#8216;FS_CHMOD_DIR&#8217;, 0751 );<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was having problem while updating one of my plugin weeks ago, telling me that<\/p>\n<p>Could not create directory. \/home\/\/public_html\/wp-content\/plugins\/download-manager Plugin install failed.<\/p>\n<p>or<\/p>\n<p>Unable to locate WordPress Content directory (wp-content).<\/p>\n<p>By then, I turned to Google for solutions, however, tried every way I got, such as: \u20221. Remove the plugin and re-install it. \u20222. [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4267"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4267"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4267\/revisions"}],"predecessor-version":[{"id":4268,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4267\/revisions\/4268"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}