Yoast / yoast-acf-analysis

WordPress plugin that adds the content of all ACF fields to the Yoast SEO score analysis.
https://wordpress.org/plugins/acf-content-analysis-for-yoast-seo/
GNU General Public License v3.0
61 stars 20 forks source link

Detect ACF blocks in preview, regardless of display mode #262

Closed TimVevida closed 4 years ago

TimVevida commented 4 years ago

Summary

Previously, only ACF block which were set to preview mode (the default mode) were communicated to Yoast SEO. However, any block mode can switch to the preview state, either automatically or manually, in the block editor. This patch just checks if such a preview exists, instead of relying on the block being in one of the modes.

This PR can be summarized in the following changelog entry:

Relevant technical choices:

During testing, I found that the order of the content passed to Yoast SEO can vary, blocks in the edit state are added as individual fields earlier in the process. Because the best results are achieved when all blocks are in the preview state, this does not seem a big deal. I do not have enough knowledge of Yoast SEO to know whether this affects SEO scoring. When needed, the fields could be sorted using compareDocumentPosition.

Test instructions

This PR can be tested by following these steps:

Fixes #261

DB-Alex commented 4 years ago

@IreneStr any idea when this will be merged?

IreneStr commented 4 years ago

@alexvandervegt My apologies for this late reply. I've been out of office. I'll make sure a dev will look at this PR this week!

maartenleenders commented 4 years ago

Hi! Sorry for the delay, took me while to understand what exactly is being fixed here. But the auto mode was indeed broken, and your code fixes it. Thanks!

Acceptance 👍