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 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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.