Support

Account

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;
    }