AdvancedCustomFields / AdvancedCustomFields/acf

ACF js filter `esc_html_dompurify_config` not working

Open
#968 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
Trying to use the new filter introduced in 6.4.3 esc_html_dompurify_config to not escape some html tags in the group label.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Editor (with a block or field with group label)
  2. Monitor the console.
  3. No console for the filter.

Expected behavior
acf filter 'esc_html_dompurify_config' to function.

Code
Tried with:

import domReady from '@wordpress/dom-ready';

domReady(() => {
 if (typeof acf !== 'undefined') {
    acf.add_filter(
      'esc_html_dompurify_config',
      function (config) {
        console.log('Sis');
        return config;
      }
    );
  }
});

and with:

acf.addFilter('esc_html_dompurify_config', function(config) {
 console.log('Bro');
  return config;
});

[!IMPORTANT]
The script is enqueued and other filters work.

Version Information:

  • WordPress 6.8.2
  • PHP Version 8.2
  • ACF Version 6.4.3
  • Browser doesn't matter

Any help will be apreciated 👉👈

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the WordPress Editor with ACF 6.4.3, using a block or field with a group label and the esc_html_dompurify_config callbacks shown in the report. Inspect whether acf.add_filter or acf.addFilter registers the filter and verify completion when the callback is invoked and can affect the DOMPurify configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.