Yoast WordPress SEO export settings problem
I have found that one of the best SEO plugins for Word Press is WordPress SEO which is yet another of Joost de Valk’s many good WP plugins.
I started to use it some months ago and apart from the learning curve that always has to be passed through I found it quite intuitive and documentation enough to do the job. All on all one of the best “free” SEO packages around.
Today I was faced with opening two new WP sites and I’m designing the themes for each so I just wanted a few plugins to get me going. I loaded WordPress SEO and started to configure the standard setting which are pretty much the same for all my sites and as I was tidying up thought I may as well use the settings export facility so I can import for the second website.
Unfortunately when you try to export it comes up with an error
Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /home/xxxxxxx/public_html/www.yyyyyyyyyyyy.com/wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php on line 90
This is when I remembered that I’d tried this some while ago with the same result – what a bummer. This time I resolved to try and find a fix and not being a PHP expert this meant searching the internet.
This time I struck gold after about half an hour searching.
I take no credit for the work but I did what the patch suggested and it works a treat but remember his warning “Try out at your own risk”.…
The patch applies to the file located in the plugin directory “wordpress-seo/inc/wpseo-non-ajax-functions.php”
This is the fix verbatim:-
There is a subtitle difference in that the dir must be an OS path when creating the file and a url when returning the file for download.
There should also be a leading / on settings.ini and settings.zip
Here is my workaround. Try out at your own risk.
NOTE: I have not tested the resulting import yet.
Additions market with > starting from line 80. Mods marked with |
> $upload_dir = wp_upload_dir();
> $wpseo_upload_path = $upload_dir['path'];
> $wpseo_upload_url = $upload_dir['url'];
| if ( !$handle = fopen( $wpseo_upload_path.’/settings.ini’, ‘w’ ) )
die();
if ( !fwrite($handle, $content) )
die();
fclose($handle);
require_once (ABSPATH . ‘wp-admin/includes/class-pclzip.php’);
| chdir($wpseo_upload_path);
$zip = new PclZip(‘./settings.zip’);
if ($zip->create(‘./settings.ini’) == 0)
return false;
| return $wpseo_upload_url.’/settings.zip’;
And the guy we should all thank for it is known as setuptips and a member of the WordPress.org Forums.