Home Forums ACF PRO get_field is not returning value


get_field is not returning value

  • I using advanced-custom-fields-pro in wordpress to allow wordpress user to type page id they wish to display in web, is there any way to get the data from wordpress user and in backend using wp_query and display the page with the data user entered in advanced-custom-fields-pro?

    Please take note, i named the field as “feature” in plugin. For my case, ‘feature’ can be contain multiple value like 1,2,3,4 so i would like to get my ‘feature’ value in array, what can i do for this?

    $feature = get_field(‘feature’);

    $the_query_featured = new WP_Query( array(
    ‘posts_per_page’ => 2,
    ‘posts_per_page’ => 2,
    ‘nopaging’ => false,
    ‘order’ => ‘DESC’, //’order’ => ‘ASC’,
    ‘orderby’ => ‘date’,
    ‘meta-key’ => $feature,
    ‘page_id’ => $feature,
    ‘post_type’ => ‘any’

    <?php while ( $the_query_featured->have_posts() ) : $the_query_featured->the_post(); ?>

  • I’m not sure I’m understanding this correctly but if the feature field is a simple text field, it will return plain text. If you need an array, you need to explode the text first (or whatever else) and use that.

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

The topic ‘get_field is not returning value’ is closed to new replies.