Home Forums Bug Reports Filter render_field not used to render a field Reply To: Filter render_field not used to render a field

  • I just used this code and can confirm the behavior (most likely a bug):

    function test__before__render_field( $field ){
    	echo '<p>This is the Before test</p>';
    add_action( 'acf/render_field', 'test__before__render_field', 9, 1 );
    function test__after__render_field( $field ){
    	echo '<p>This is the After test</p>';
    add_action( 'acf/render_field/type=text', 'test__after__render_field', 10, 1 );

    Notice that the last action (after) is hooked to a field type.

    If I just put ‘acf/render_field’ there, both actions appear before my text field, even if I set priority 999 instead of 10.

    But if the field type is defined, it all works as in the docs: priority < 10 hooks before rendering the fields and priority >= 10 hooks after.

    @ewijdemans I hope I have helped you solve your issue, at least until @hube2 doesn’t bring it to developer’s attention.

    (Tested using ACF Pro 5.6.7)

    edit: after reading the OP one more time, I realized that it’s clear from the beginning that field type is working properly 🙂