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

P3-147 Fix refresh analysis #275

Closed afercia closed 3 years ago

afercia commented 4 years ago

Summary

This PR can be summarized in the following changelog entry:

Relevant technical choices:

  1. I'm using the new ACF JavaScript API introduced in ACF 5.7: https://www.advancedcustomfields.com/resources/javascript-api/
  2. important: this means the new code is not compatible with previous ACF versions (the current version is 5.9.1)
  3. I'm using the acf.Model API with an input event: this event fires for changes to any native form element including checkboxes, radio buttons, select elements. Changing the value of these form elements will trigger an analysis refresh even if, actually, there's no change in the post content. I opted to not filter out these form elements to keep things simple and because you never know (e.g. checking a checkbox could add some content in some edge cases?).
  4. I disabled the ESLint no-unused-vars when creating the new acf.Model instance because I wouldn't know how to do it otherwise.
  5. I made sure acf analysis works in Classic Editor: it stopped working after https://github.com/Yoast/wordpress-seo/pull/15842 because the post-edit script now uses two different handles: post-edit and post-edit-classic
  6. Changed a add_filter() call to add_action(): although the former works, the latter is the correct one to use because admin_enqueue_scripts is an action
  7. Removed the yoast-acf-analysis script dependency for post-edit to simplify (see point 5) and because there's already a conditional to check whether post-edit is enqueued

Test instructions

Preliminary steps:

Screenshot 2020-09-08 at 13 57 39

Actual testing:

JSON file with the group field: acf-export-for-PRO.json.zip

Fixes [P3-147]

JesserH commented 4 years ago

CR ✅

enricobattocchi commented 3 years ago

Acceptance test OK :+1:

It also fixes QAK-2178 and QAK-2211

mmikhan commented 3 years ago

@enricobattocchi Any milestone for this?