Home › Forums › General Issues › Dynamically registered (via PHP) relationship fields return no results › Reply To: Dynamically registered (via PHP) relationship fields return no results
Yes, everything is registered in functions.php
1. add_action( 'init', 'registerPostTypes', 0 );
2. add_action( 'acf/init', 'addFieldsByLevel' );
3. In addFieldsByLevel
function I’m looping through taxonomy terms and adding a field for each of the term (code in the earlier post).
And yes just before the loop I’m checking for the post ID which works on admin
if ( isset( $_GET['post'] ) ) {
$post_id = $_GET['post'];
} else if ( isset( $_POST['post_ID'] ) ) {
$post_id = $_POST['post_ID'];
} else {
return;
}
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!
We’re working hard on Advanced Custom Fields PRO 6.0, and Beta 1 is now available 🚀
— Advanced Custom Fields (@wp_acf) August 12, 2022
Featuring improved performance for Repeater fields with large datasets, and a new generation of ACF Blocks.
Let’s take a look 🧵https://t.co/Befre3kFAo
© 2022 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.