• I’m wondering if I can exclude a specific ACF repeater field from Yoast analysis, depending on whether a box is checked, this kind of logic:

    Each repeater row has two sub fields, ‘yoast_ignore’ and ‘text’

    if(get_sub_field('yoast_ignore')) {
       // yoast ignore 'text' in this repeater row
    }

    Perhaps this can be achieved in a similar way to the blacklist filters on the plugin homepage? Any help appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • @oldjoeblind Thanks for asking. I had to check with a development team for an answer to this, but they say it is possible, but may require a bit of work.

    Since the analysis happens in JavaScript in the post editor, removing a field from the analysis should happen in JavaScript as well.

    It would need some work on your end though. You’d need to write a JavaScript file that:

    1. Listens for changes in these yoast_ignore checkbox subfields.
    2. When one of the checkboxes is checked: adds the parent field’s name to the window.YoastACFAnalysisConfig.blacklistName global variable.
    3. When one of the checkboxes is unchecked: remove the parent’s field name from the global variable again.

    Please let us know if that helped you!

    Thread Starter oldjoeblind

    (@oldjoeblind)

    Thanks @tacoverdo

    I’m looking at this now, and all looks fine in theory. When you say ‘add the parent field’s name to the blacklist’

    How do I find / retrieve the parent field’s name?

    Bear in mind it’s the specific row I’m looking to ignore, and not all textareas in all repeating blocks.

    I did wonder whether it should be the name of the specific textarea, e.g.:

    <textarea id="acf-editor-145" class="wp-editor-area" name="acf[field_60a4f0812ccda][621664f82d1d5][field_60a504c5597a3]" aria-hidden="true"></textarea>

    Many thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Ignore repeater field, conditionally’ is closed to new replies.