Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor screen is showing content from a different post. #7468

Closed
fredbradley opened this issue Jun 22, 2018 · 19 comments · Fixed by #7889
Closed

Editor screen is showing content from a different post. #7468

fredbradley opened this issue Jun 22, 2018 · 19 comments · Fixed by #7889
Assignees
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript [Type] Bug An existing feature does not function as intended
Milestone

Comments

@fredbradley
Copy link

fredbradley commented Jun 22, 2018

Describe the bug
My Gutenberg Editor is constantly showing POST ID 9 of my posts table, rather than the post in the uri query string.

This means I can't actually edit any page with Gutenberg?

To Reproduce
WP 4.9.6. Gutenberg 3.1.0
the primary site of a Multisite, with Custom Post types. (Worth saying that ID 9 is a custom post type, rather than just a post, and not the post type I'm intending to view!)

Click to edit any post of any post type.

Expected behavior
The edit screen of the item you clicked on (and of the item that URI Query string suggests)

Screenshots
Not applicable/private information

Desktop (please complete the following information):

  • OS: MAC
  • Browser CHROME
  • Version, latest

Additional context

  • Gutenberg 3.1.0
@easilyamused
Copy link
Contributor

I'm also having this issues, however if I click on classic edit it the correct content.

@fredbradley
Copy link
Author

fredbradley commented Jun 22, 2018

@easilyamused Yes - as in it's the Gutenberg editor that is picking up the wrong ID somehow. ? Out of interest what POST ID is your Gutenberg Editor showing? I'm intrigued if it's just picking up the first available post in the post table.

@easilyamused
Copy link
Contributor

That's what it looks like to me with my debugging.

@fredbradley
Copy link
Author

@easilyamused Also - are you on a Multisite install of a normal single site?

@easilyamused
Copy link
Contributor

Single site, I have a multisite setup using the Gutes, but did not install after this bug popped up.

All my settings seem to be the same as your @fredbradley too.

@opicron
Copy link

opicron commented Jun 23, 2018

Can confirm, happening on custom post/page types for me too. The URL parameter shows the correct ID but the actual editor screen shows an different post.

It is so random. Even when the correct right content is shown, after one edit and a save the editor shows the wrong post/page.

Trying to edit custom page type with ID 3811, and the content of post 9658 is shown. Which is not the first or last ID in tables.

*update: now it is happing now standard posts too :/

@danielbachhuber
Copy link
Member

Hi folks,

Some follow-up questions:

  • Does the issue reproduce with all other plugins deactivated?
  • Are you able to reproduce the issue with a fresh WordPress install?

@danielbachhuber danielbachhuber added the [Status] Needs More Info Follow-up required in order to be actionable. label Jun 27, 2018
@easilyamused
Copy link
Contributor

easilyamused commented Jul 7, 2018

@danielbachhuber I have not checked and I did not try on a fresh Install.

However, I do have some new news.

This issues does not seam to be a problem in 3.0.1 and before(Have been using the Gutes since the beginning).

Today I tried Gutenberg on a site for the first time on a new host and everything seemed fine for the first 9ish hours. I converted 19 pages without any real problems. I even edited some of them too. Was super happy the grid for nested blocks was fixed(not related). Then the problem showed back up. This might seem crazy, but as soon as all pages where Gutenberg pages, the problem showed back up. That last detail could be coincidence.

The new site is running the current versions of all core, theme, and plugins. Its on storefront(Woocommerce site, and on a standalone(not the cheap hosting) at GoDaddy. Was messing up on Pantheon when I first reported the issue.

Also the classic edit works. When i click on edit, Gutenberg loads but not the right content. We know that from above, but what's weird is that its loading a post not even a page.

I will report on a different ticket, but the save seems to be hanging. It will save but the save never stops trying or at lest looking like its trying to save. A refresh seems to work and the saved data is there.

I know this is a lot of vague info and happy to provide more if I know what was needed.

@chameleon-tbn
Copy link

Same issue here on one of my sites in german language. WP 5.0-alpha-43406 with Gutenberg Version 3.2.0.

It is not really a random post id selected. For me just one category of posts have this strange behavior.

To explain in Details:

I have 9 posts in category&tag_ID=35 with a unique Name. Editing each posts lead for 8 of these to the post with one specific id. Editing the post with that specific id leads to on other post from category 35.

The adress-path is correct and if i add &classic-editor at the and of the addres the correct article is opened.
Also it is not all data wrong editing these posts with Gutenberg! As i have installed the All in One SEO Pack plugin i can see that the data downwards at the edit page has the title and description of the selected post.

As it was strange for me, that this happens only to that specific category, i disabled all other plugins and where finally able to find the plugin that causes this error on my page: List category posts https://de.wordpress.org/plugins/list-category-posts/

I've submitted this also to creator of LCP picandocodigo/List-Category-Posts#320

This is really freaky...

@easilyamused
Copy link
Contributor

After more research, and looking at ticket #7833, it seems to be related to posts with shortcodes that query other post content. Pages with out shortcodes work fine. I have not debug different types of shortcode yet. The live page is https://www.freshfarmscbd.com/. The case studies is a blog category.

@chameleon-tbn
Copy link

'List Category Posts' did issue an update last night to the plugin. Error caused by that Plugin seems now to be fixed.

@annestk
Copy link

annestk commented Jul 10, 2018

Can confirm I'm experiencing the same error.

For me, it occurs only when the plugin Display Posts Shortcode is active, and the post I want to edit with Gutenberg contains a display posts shortcode.

@billerickson
Copy link

I believe this is related to a bug in WP where wp_reset_postdata() doesn't work in the backend (WP core ticket #18408).

Is Gutenberg running the shortcodes to generate a preview?

I think this should be something that is addressed in WordPress core, but Gutenberg could probably work around it by manually resetting the post data after shortcode previews are complete.

@danielbachhuber danielbachhuber added [Type] Bug An existing feature does not function as intended Framework Issues related to broader framework topics, especially as it relates to javascript and removed [Status] Needs More Info Follow-up required in order to be actionable. labels Jul 10, 2018
@danielbachhuber
Copy link
Member

Is Gutenberg running the shortcodes to generate a preview?

Gutenberg runs shortcodes when it calls GET /wp/v2/posts/<id> on the initial pageload.

https://core.trac.wordpress.org/ticket/18408 seems like it'd be the cause of the problem. If the shortcode sets up the global $post, but isn't able to reset it, then Gutenberg could load data some some erroneous $post data.

@danielbachhuber
Copy link
Member

I've got a fix in #7889

@aduth
Copy link
Member

aduth commented Jul 11, 2018

Related: #7582 (previously #7461)

@nmschaller
Copy link

Hi @danielbachhuber ,

Seeing that you closed my issue and worked on a solution ...

As an end user, I don't understand what you are talking about. I'd like to know: Is this issue fixed in the official Gutenberg plugin - can I update to Gutenberg 3.6.2 now or would this issue persist?

Thanks

Nicole

@danielbachhuber
Copy link
Member

Hey @nmschaller,

Yes, the issue is fixed in the latest version of Gutenberg. It's been fixed as of Gutenberg 3.3.

@nmschaller
Copy link

Thanks a lot, @danielbachhuber.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants