Support

Account

Home Forums General Issues again get_field -> NULL / Empty

Helping

again get_field -> NULL / Empty

  • I really searched the forum and stackoverflow, but I don’t get the point:

    Trying to read a value from my fields and get an empty return. Why is this?

    add_filter('acfe/upload_dir/name=dokumenten_upload', 'gp_directory', 10, 2);
    
    function gp_directory($uploads, $field) {
    
    	global $post;
    	$doctype = get_field("doc_type", $post->ID );
    
    	echo $post->ID;
    	var_dump ($doctype);
    
    }

    “doc_type” ist the name of my field (a select field)
    echo $post->ID prints the right value of the current post I create.

    Thank you,
    Michael

  • Ok, if I update a post, I get an value. This is the stored value on creation.
    I think “get_field” does not work with the actual field value (if I create a new post). It reads the previously stored value(?)

    How can I populate the value I just insert into the field?

    Thank you,
    Michael

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.