wp-graphql-acf icon indicating copy to clipboard operation
wp-graphql-acf copied to clipboard

ACF page link & Taxonomy link - cant access values chosen

Open Kainkainkain opened this issue 4 years ago • 2 comments

It is listed as supported, but requires extra {} in the query, but the suggestion of graphiql is always "__typename" and won't suggest other fields. Perhaps I just need to know the underlying default values in the array.

{
  events {
    nodes {
      title
     content
      attr {  //ACF
        eventLink
        eventLinkLabel
        internalEventLink { //<< THIS BAD BOY RIGHT HERE
					__typename          
        }
        datetime
        endTime
        audience        
        venueLocation
        eventImage {
          sourceUrl//<< OLD MATE HERE SUGGESTED ME A FEILD A-OK
        }
      	bigOrSmall
      }
    }
  }
}

Kainkainkain avatar Aug 07 '19 18:08 Kainkainkain

Has there been any progress on this? Can’t see it in the projects as linked but having the same issue at the moment, trying to access a Page Link ACF field. As a workaround for the moment, I'm using inline fragments which allows me to get the fields I need:

heroButtonLink { // <-- Page Link ACF Field
    ... on Page {
        uri
        link
    }
}

davemcnally avatar Dec 06 '19 10:12 davemcnally

I'm also having this issue, but the inline fragments don't even work for me. I have a link between 2 custom post types, and although I can query both of them, the fragment to access the linked post doesn't work.

I've tried the post_object field in ACF (returning both an object and an id), in the end I had to use the relationship field

query MyQuery {
  sentences(first: 2) {
    nodes {
      slug
      testRelationObject {
        posts {
          ... on Alignment {
            id
          }
        }
      }
    }
  }
  alignments(first: 2) {
    edges {
      node {
        id
      }
    }
  }
}

amykapernick avatar Apr 07 '20 02:04 amykapernick

This appears to have been fixed a while ago.

I'm able to create a field group with a "Page Link" field and query it as expected:

CleanShot 2023-07-11 at 11 16 30

Attached is a JSON export of the Field Group I tested with (named "Delete Me" to make sure you remember to delete the test field group 😄)

acf-export-2023-07-11.json.zip

Tested on:

  • WPGraphQL: v1.14.6
  • WPGraphQL for ACF v0.6.1

jasonbahl avatar Jul 11 '23 17:07 jasonbahl

Here's an example of querying the Page Link field type using the same exported field group with:

CleanShot 2023-07-11 at 11 24 34

  • WPGraphQL v1.14.6
  • WPGraphQL for ACF v2.0.0-beta.3.1.0 (https://github.com/wp-graphql/wpgraphql-acf/releases)

jasonbahl avatar Jul 11 '23 17:07 jasonbahl