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 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
📣 “ACF Chat Fridays”
— Advanced Custom Fields (@wp_acf) January 31, 2023
The ACF team holds their first open office hours this Friday! Come and talk ACF, and ask questions about building sites with the plugin.
We’d love to see you there!
📆 Friday 3rd Feb - 3pm UTC
👉 Register here - https://t.co/3UtvQbE4CU pic.twitter.com/oTwW9K1XQ0
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.