Home Forums Front-end Issues Field not displayed in a new WP_Query


Field not displayed in a new WP_Query

  • Hello,

    I have a problem with a varialbe which is not recovered.

    I created a block called “Block: Articles” allowing, via Gutenberg, to display the articles, at choice:
    – select the latest articles
    – choose one or more articles in particular, among all existing ones

    I also created another group of “Thumbnail image” control to add an image field to the post type Post.

    Everything works fine in the queries, except when I ask to retrieve the information from the “Block – Article” block. In this case, it does not retrieve any information for the “Thumbnail image” control.

    Should it be called another way than:
    $ image = get_field (‘image_miniature’);

    Thanks for your help.

    For information :
    Wordpress 5.6
    ACF Pro 5.9.3

    $argType = get_field( 'actus_loop' );
    if( $argType == "count" ) :
      $args = array( 
        'orderby' => 'date',
    	 'order' => 'DESC',
        'post_type' => 'post',
        'posts_per_page' => $numbers,
      $actus = get_field( 'actus_select' );
      $args = array( 
        'orderby' => 'title',
        'post_type' => 'post',
        'post__in' => $actus,
    $the_query = new WP_Query( $args );
     <?php if( $the_query->have_posts() ) : while( $the_query->have_posts() ) : $the_query->the_post(); 
            $image = get_field('image_miniature');
            echo $image['url'] ;
    endwhile; endif; ?>
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.