What's Changed
Fixed
- Star Rating votes never saved. Since 2.9.0 the public
acf-blocks/v1/ratingsroute usedfloatvalas thesanitize_callbackforratingandinitialRating. WordPress calls sanitize callbacks with three arguments ($value,$request,$param), and an internal PHP function given more arguments than it accepts throwsArgumentCountErroron PHP 8 (PHP 7 warned and returnednull, which the range check then rejected). Every submission failed before reaching storage: a 500 on PHP 8, a 400 on PHP 7. Both arguments now useacf_star_rating_sanitize_float(), which also turns non-numeric input, arrays included, into 0, so the existing 1 to 5 range check answers it with a 400 instead of counting it. - The Star Rating widget had no REST URL on block themes. The script was registered on
wp_enqueue_scripts, but a block theme renders its template, and every block in it, beforewp_headfires that hook. The render template'swp_localize_script()call hit an unregistered handle and returned false, and a static flag stopped later renders from retrying, sowindow.acfStarRatingwas never defined and the submit handler returned without sending anything. Registration and localization now happen once oninit, and the template calls the same helper before enqueueing so renders outside the normal hook order are covered too. Classic themes, wherewp_enqueue_scriptsruns before the content, were only affected by the first bug.
Added
- Regression tests: every sanitize callback on the ratings route must be a PHP function that tolerates WordPress's three arguments, and the Star Rating script must be registered and localized on
init, with no localization left in the render template.
Commits
- 2.11.4: fix Star Rating votes on PHP 8 and block themes (
8676090) - docs: add Buy Me a Coffee support links to README (
2ebb43d)
Stats
- Commits: 2
- Changes: 7 files changed, 140 insertions(+), 31 deletions(-)
Plugin Info
- Blocks included: 29
- Requires WordPress: 6.0+
- Requires PHP: 7.4+
- Requires: ACF Pro 6.0+ or Secure Custom Fields
Installation
- Download
acf-blocks-plugin-*.zipfrom the assets below - Go to Plugins → Add New → Upload Plugin in WordPress admin
- Upload the zip file and activate