REST API - Head Tags doesn't work with Yoast SEO ^14.0 [5pt]
DAreRodz opened this issue · comments
Bug report
Our plugin integration with the Yoast plugin stopped working since the release of its 14.0 version.
They made a major release and they have practically rewritten the whole code; all the functions and classes we are using are now deprecated. Having said that, we should rewrite setup
and reset
functions in the Yoast integration (nothing of the following code is valid):
Expected behavior
I should include the Yoast meta tags in the head_tags
field for all entities, not just for the first one.
Observed behavior
It only works for the first entity.
The current code is removing all hooks attached to the wpseo_head
action in the reset
function:
and calling this the Yoast reset function after that
which was adding all hooks once again, apart from other stuff. That function simply does nothing since the 14.0 version of Yoast SEO.
Steps involved to reproduce the problem
Just install the latest version of both Head Tags and Yoast SEO plugins.
Possible solution
I don't see an easy solution in this case. We will have to study the Yoast SEO code in-depth and look for public functions and classes we could use to get the meta tags rendered in the wp_head
action for a given WP_Query
.
At least their code has improved a lot!
@DAreRodz, is there a way to distinguish between the versions of Yoast to keep the current integration for Yoast v13 and lower and create a new one for v14 and higher?
Instead of fixing it in the Head Tags plugin, as we have to change the whole implementation, we're planning to create a @frontity/yoast
package that we'll get the info from the Yoast REST API fields. This way, users with Yoast ^14.0 should use this new package, and the ones using older versions, can install the Head Tags plugin.