Support

Account

Home Forums ACF PRO Getting ACF field from a taxonomy in a page with WP_query Reply To: Getting ACF field from a taxonomy in a page with WP_query

  • That really does not help?

    I see a query for posts. This has a taxonomy query. This includes 'fields' => $logo,. There is not “fields” argument for a taxonomy query. There is a “field” argument, but that argument does not take the value you are attempting to use. So I can’t really tell what posts you are trying to get here?

    From what I understand you are also trying to get an image file from the term here $logo = get_field('logo_marque'); Getting a value from a term requires that you know the term, or at least the term ID and supply this when getting the ACF field. https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/

    I a guessing that you want to show posts in a term and show the term images for the post. In this case your taxonomy query requires the term ID, name, or slug to search posts by. For example

    
    'tax_query => array(
      array(
        'taxonomy' => 'marques-produits',
        'field' => 'term_id',
        'terms' => $term_id
      )
    )