Closed jake-101 closed 4 years ago
It looks like this line conflicts with what I put into my functions.php file maybe and already has a code comment saying it might conflict elsewhere. i'll comment it out and try it out
Well that fixed it!
@jake-101 can you share details on how you are using the X-JWT-Total?
Typically, the total count would be exposed in the query itself, as you can query many resources in a single request.
For example:
{
posts {
nodes {
id
title
}
}
pages {
nodes {
id
title
}
}
}
A query like this would, I imagine, have trouble showing the total, as you're querying both Posts and Pages.
A common place to show the total is within the query's pageInfo, like so:
posts {
pageInfo {
totalCount
}
nodes {
id
title
}
}
pages {
pageInfo {
totalCount
}
nodes {
id
title
}
}
}
This way each query can expose the total for the resources being requested.
The core WPGraphQL plugin doesn't support totalCount at the moment, but I've got documentation on how to accomplish this here:
I had this same issue and it was specifically causing me trouble by preventing the "Authors" dropdown in the post editor from populating with all the authors (presumably because it uses the number of total pages to know how many times to query for more authors until the list is complete). I fixed by updating the set_headers
(which sets all headers) functions calls in the add_auth_headers_to_rest_response
function to use header
(which sets a single header), I believe on lines 345 and 360 in ManageTokens.php
.
I've actually opened a PR with the fix I implemented locally. #118
Thanks @tsmith-rv your fix worked for me. @jasonbahl is there any reason not to merge #118?
I am trying to set up an API integration that requires X-WP-Total but it looks like the WP GraphQL JWT plugin is conflicting somewhere to block it from showing in a response. I have it in my access-control-expose headers but it doesn't return correctly. If I deactivate the plugin it works fine but I use JWT Auth for a feature elsewhere. :( I tried to search for other issues but didn't see a solution. Any help would be super appreciated. Thanks!