Home Forums General Issues acf.registerConditionType not working Reply To: acf.registerConditionType not working

  • With big thanks to Elliot for helping me figure this out, and for the benefit of anyone else who finds this, the main problem was wrapping acf.Condition in jQuery on ready.

    For testing purposes, this code works and can be added to a theme’s functions.php:

    add_action( 'acf/admin_footer', 'my_admin_footer' );
    function my_admin_footer() {
    (function( $ ) {
    	'use strict';
    	var HasTerm = acf.Condition.extend({
    		type: 'hasTerm',
    		operator: '==hasTerm',
    		label: acf.__('Has term'),
    		fieldTypes: [ 'taxonomy' ],
    		match: function( rule, field ){
    			return rule.value === field.val();
    		choices: function( fieldObject ){
    			return '<input type="text" />';
    	acf.registerConditionType( HasTerm );
    }( jQuery ));