Wordpress ACF get_field( ) not returning value
If you're using WP_Query()
before using get_field()
, you need to reset the query using wp_reset_query()
function. I hope it'll solve this issue.
You're using get_the_ID() outside of the loop.
http://codex.wordpress.org/Function_Reference/get_the_ID
You could try:
global $post;the_field( 'the-title', $post->ID );
But this would depend on what page you're on.
Which template file is this being used in?
You need to create a loop, then inside that loop you can retrieve the data.
<?php while( have_posts() ) : the_post() ?> <?php $variable = the_field('the-title'); ?><?php endwhile; ?>