I’m working on a Vue.js project where I use GraphQL (WPGraphQL v1.26.0) to fetch posts from a WordPress site (with Apollo).
I need to display the last modified date of each post, but the “modified” parameter always returns the same value as the date field (creation date) even in the plugin query execution.
Here is the relevant part of my GraphQL query:
query FetchPostByUri($uri: String!) {
postBy(uri: $uri) {
date
modified
}
}
Has anyone encountered this issue before or knows why this might be happening?
I tried to modify my GraphQL query to fetch the lastEditedBy field, hoping it would give me the correct modified dates for the posts. Here’s the modified part of the query:
edges {
node {
lastEditedBy {
node {
posts {
nodes {
date
}
}
}
}
}
}
But this gives a bunch of dates which does not correspond to the actual revisions.