frontity/wp-plugins

REST API - Head Tags doesn't work with AIOSEOP ^4.0.0 [13pt]

DAreRodz opened this issue ยท 12 comments

Our Head Tags plugin stopped working with the All In One SEO Pack plugin after they released the 4.0.0 version.

As the new version is a major refactor, we would have to take a deep look into the new code in order to update our AIOSEOP integration accordingly.

My guess is that finding the specific problem involved and come up with a proper solution would be a time-consuming task.

The issue was found while working on frontity/frontity#664

@SantosGuillamot could you assign a priority value to this issue before taking a deeper look?

I've seen that, since 4.0, All In One plugin uses the REST API. Do you think this will be useful to adapt our plugin?

From what they say in those docs it seems like the plugin UI is the one using the REST API, probably to retrieve and save the settings.

It doesn't seem like they are exposing the head tags in the entities of the REST API like Yoast.

Hey folks! It seems that there's no problem with the new version in the end. As I opened this issue because the e2e tests were failing, I think the problem could be related to some incompatibility between the DB content and the new plugin version.

I'm going to create a new test suite for AIOSEO v4 using a clean DB and check if it works without having to modify this plugin.

EDIT: Nevermind, I was wrong. The plugin is not working with AIOSEO v4.

One thing I've found is that the function that adds filters to modify the title tag is added to the wp hook, which is not fired on a REST API call. Therefore, the default title of an entity is not modified.

Another thing I've noticed is that the tags for entities following the first one are missing those generated by AIOSEO, I don't know why (yet).

I'll keep investigating. ๐Ÿ•ต๏ธ

I've found why the AIOSEO tags are missing for the second and following entities.

  1. The callback that AIOSEO attaches to the wp_head hook is init() (/app/Common/Main/Head.php)
  2. Inside that function, output() is called.
  3. output() runs a bunch of several .php files - called views - to render the meta tags but using require_once(), so output() only works the first time is executed.

If we write an integration for AIOSEO v4, we should override that option() function somehow.

I've opened an issue in the AIOSEO plugin's support page. I'm gonna set this as blocked until they respond.

https://wordpress.org/support/topic/issue-exposing-meta-tags-in-the-rest-api/

They were fast ๐Ÿ™‚

Yeah, they are going to fix it in their plugin and it's going to be released in the next version. โ˜บ๏ธ

By the way, we would still have to write an integration, but it'll be a simple one.

I've seen that they already released a new version (4.0.16), and it seems the issue is solved.

I've done a quick test and it seems the head_tags field is being populated correctly, including the second and following entities. @DAreRodz Could you please confirm this solves the issue that was blocking us?

I didn't try this locally yet, but they've changed the code: now they're using require instead of require_once! ๐ŸŽ‰

https://plugins.trac.wordpress.org/browser/all-in-one-seo-pack/trunk/app/Common/Main/Head.php#L173

I think we still have to write an integration to handle the <title> tag. I'll take a look later.

Looks like not only the <title> but the <link rel="canonical"> tag is failing as well, at least for authors, categories and types.