• Resolved japor

    (@japor42069)


    Changes in the terms doesn’t reflect with the preview state.

    Steps to reproduce

    1. Create a post, set a tags and publish it

    2. Edit the post, change the tags

    3. Click the “Preview” button

    4. Query the post with the asPreview = true;

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jason Bahl

    (@jasonbahl)

    @japor42069 the client application making the query with asPreview = true needs to be authenticated and have proper access to view previews.

    Public clients will see published data, authenticated clients will see the preview data.

    Thread Starter japor

    (@japor42069)

    @jasonbahl I’m using the GraphQL IDE with an authenticated user. Most of the fields (ACF, Post title, Content) are getting updated in the preview query except for the Terms (Tags, Categories).




    CMS (highlighted one is the changes)

    GraphQL IDE with authenticated user on.

    • This reply was modified 1 year, 8 months ago by japor.
    Plugin Author Jason Bahl

    (@jasonbahl)

    @japor42069 I think you’ve also opened an issue on the Github repo.

    This behavior matches WordPress core behavior.

    If you preview a post in non-headless WordPress, the terms associated with the preview will be displayed in the preview template from the parent (published) post, not the preview revision.

    For example, I have a published post that’s in the “Uncategorized” category.

    If I view the published post (non-headless WordPress) I see that it’s in the “Uncategorized” category

    If I go in the editor and click to add new terms:

    Then click “preview”, I will still see only the “Uncategorized” category associated with the post.

    WPGraphQL is behaving in the same way. If you query a Post using asPreview => true, then query connected terms, it will resolve the connected terms from the parent (published) post.

    Based on how core WordPress previews work, what you’re describing is the behavior I would expect from WPGraphQL.

    • This reply was modified 1 year, 8 months ago by Jason Bahl.
    Plugin Author Jason Bahl

    (@jasonbahl)

    @japor42069 I replied to you in Github with a code snippet that might help you accomplish what you’re after.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Changes in the terms doesn’t reflect with the preview state.’ is closed to new replies.