Wordpress-seo: Installing plugin via composer won't activate

Created on 9 Aug 2016  Â·  7Comments  Â·  Source: Yoast/wordpress-seo

What did you expect to happen?

Ran: $composer require yoast/wordpress-seo
Plugin got installed successfully.
Went to /wordpress/wp-admin/plugins.php and activate the plugin and get the plugin activated

What happened instead?

Clicking on Activate failed with the message:
Activation failed: The Yoast SEO plugin installation is incomplete. Please refer to installation instructions.

After digging on the code I've found out that the wp-seo-main.php was looking for the wrong autoloader & it was not using the composer "vendor-dir" location

How can we reproduce this behavior?

Ran: $composer require yoast/wordpress-seo
Go to /wordpress/wp-admin/plugins.php and activate the plugin

Can you provide a link to a page which shows this issue?

Technical info

  • WordPress version: "johnpbloch/wordpress" : ">=3.9"
  • Yoast SEO version: "yoast/wordpress-seo": "^3.4"
question

Most helpful comment

adding this to top of wp-settings.php did the trick for me:

require_once(__DIR__ . '/vendor/autoload.php');

All 7 comments

If you are requiring plugin on site stack level do you include _that_ autoloader in boot process?

If the plugin is required as dependency it's not its responsibility to handle autoload.

Hi Andrey,

Thanks for the quick reply.

The autoloader is required by the Yoast Plugin as you can see here:
https://github.com/Yoast/wordpress-seo/blob/trunk/wp-seo-main.php#L53

Even if the vendor folder is on the same folder as the plugin, as the code
expects, the Yoast plugin is looking for an autoloader file that doesn't
exist in the vendor folder (even after all required composer packages
required by the Yoast plugion comopose.json are installed).

Thanks!

On Tue, Aug 9, 2016 at 9:02 AM, Andrey Savchenko [email protected]
wrote:

If you are requiring plugin on site stack level do you include _that_
autoloader in boot process?

If the plugin is required as dependency it's not its responsibility to
handle autoload.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Yoast/wordpress-seo/issues/5361#issuecomment-238532399,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEryoUFQZi09J1MXEfFh3hB8IMBTN5Uks5qeGxrgaJpZM4JfmQY
.

The autoloader is required in a case you are _only_ building a plugin and nothing but it.

If you are _requiring_ a plugin as dependency in a larger project then its classes are included in _project's_ autoload and you need to boot _that one_.

Are you including _project's_ autoload in your boot process?

oh - I gotcha - you are right - my wp vendor autoload was wrong.

I have fixed it and everything worked.

Thanks and sorry for the trouble.

adding this to top of wp-settings.php did the trick for me:

require_once(__DIR__ . '/vendor/autoload.php');

Please refer to

Activation failed: The Yoast SEO plugin installation is incomplete

Was this page helpful?
0 / 5 - 0 ratings