nextjs-wordpress-starter
nextjs-wordpress-starter copied to clipboard
CPT: Expected type IvIdType, found SLUG
``Hey there,
Running into an issue retrieving posts by an ID.
I can view my posts on /ivs and see all them there, but clicking into them results too "Expected type IvIdType, found SLUG"
Has anyone ran into a similar issues, this is my first time coming around to it.
queryIvById.js file
`import authorPostFields from '@/lib/wordpress/_query-partials/authorPostFields'
import defaultPageData from '@/lib/wordpress/_query-partials/defaultPageData'
import featuredImagePostFields from '@/lib/wordpress/_query-partials/featuredImagePostFields'
import globalPostFields from '@/lib/wordpress/_query-partials/globalPostFields'
import seoPostFields from '@/lib/wordpress/_query-partials/seoPostFields'
import { gql } from '@apollo/client'
// Fragment: retrieve single team member fields.
const singleIvFragment = gql`
fragment SingleIvFields on Iv {
${globalPostFields}
blocksJSON
excerpt
${seoPostFields}
${authorPostFields}
${featuredImagePostFields}
}
`
// Query: retrieve team member by specified identifier.
const queryIvById = gql`
query GET_IV_BY_ID(
$id: ID!
$idType: IvIdType = SLUG
$imageSize: MediaItemSizeEnum = LARGE
) {
${defaultPageData}
iv(id: $id, idType: $idType) {
...SingleIvFields
}
}
${singleIvFragment}
`
export default queryIvById
`
````import authorPostFields from '@/lib/wordpress/_query-partials/authorPostFields'
import defaultPageData from '@/lib/wordpress/_query-partials/defaultPageData'
import featuredImagePostFields from '@/lib/wordpress/_query-partials/featuredImagePostFields'
import globalPostFields from '@/lib/wordpress/_query-partials/globalPostFields'
import seoPostFields from '@/lib/wordpress/_query-partials/seoPostFields'
import { gql } from '@apollo/client'
// Fragment: retrieve single team member fields.
const singleIvFragment = gql`
fragment SingleIvFields on Iv {
${globalPostFields}
blocksJSON
excerpt
${seoPostFields}
${authorPostFields}
${featuredImagePostFields}
}
`
// Query: retrieve team member by specified identifier.
const queryIvById = gql`
query GET_IV_BY_ID(
$id: ID!
$idType: IvIdType = SLUG
$imageSize: MediaItemSizeEnum = LARGE
) {
${defaultPageData}
iv(id: $id, idType: $idType) {
...SingleIvFields
}
}
${singleIvFragment}
`
export default queryIvById
`
`import authorPostFields from '@/lib/wordpress/_query-partials/authorPostFields'
import defaultPageData from '@/lib/wordpress/_query-partials/defaultPageData'
import featuredImagePostFields from '@/lib/wordpress/_query-partials/featuredImagePostFields'
import globalPostFields from '@/lib/wordpress/_query-partials/globalPostFields'
import seoPostFields from '@/lib/wordpress/_query-partials/seoPostFields'
import { gql } from '@apollo/client'
// Fragment: retrieve single team member fields.
const singleIvFragment = gql`
fragment SingleIvFields on Iv {
${globalPostFields}
blocksJSON
excerpt
${seoPostFields}
${authorPostFields}
${featuredImagePostFields}
}
`
// Query: retrieve team member by specified identifier.
const queryIvById = gql`
query GET_IV_BY_ID(
$id: ID!
$idType: IvIdType = SLUG
$imageSize: MediaItemSizeEnum = LARGE
) {
${defaultPageData}
iv(id: $id, idType: $idType) {
...SingleIvFields
}
}
${singleIvFragment}
`
export default queryIvById
`