Opened 12 months ago
Closed 12 months ago
#63240 closed defect (bug) (reported-upstream)
footnotes problem
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | major | Version: | 6.7.2 |
| Component: | Editor | Keywords: | |
| Focuses: | Cc: |
Description (last modified by )
Hi,
There's a problem with footnotes, everytime we updates footnotes and save the post, the footnotes are not up to date. In fact, i managed to find something, maybe it will help and i don't know if it's correlated or not, you'll tell.
I saw in phpmyadmin, everytime we save the post, a new line in table postmeta appear, that contain a new post_id with meta_key-"footnotes" is created. This new line does not contain the original id of the post, a new id for the post is associated.
Example in database, table "postmeta" :
| meta_id | post_id | meta_key | meta_value |
|---|---|---|---|
| 1769 | 1595 | footnotes | [{whatever...}] |
| 1770 | 1596 | footnotes | [{whatever2...}] |
and so on.
And everytime we edit the post, it seems it loads the footnotes with original post_id, and not the last saved. So, maybe there's a problem incrementing post_id in this table. (and maybe it can collide with other posts ??)
(i hope i'm clear, i'm sorry for my english if it is not clear)
Change History (14)
#3
@
12 months ago
After further investigation, it appears that the issue is linked to how the footnotes post meta is handled in relation to post revisions.
As defined in wp-includes/blocks/footnotes.php, the footnotes field is registered with the revisions_enabled => true flag:
register_post_meta(
$post_type,
'footnotes',
array(
'show_in_rest' => true,
'single' => true,
'type' => 'string',
'revisions_enabled' => true,
)
);
So every time a post is saved, a new row is inserted in postmeta with a post_id pointing to the revision, not the main post.
Suggestion :
- on post update, automatically copy the latest
footnotesmeta from the latest revision to the main post - OR, the editor should fetch
footnotesfrom the latest revision instead of the main post
At least until proper revision handling is implemented, consider setting 'revisions_enabled'=>false to avoid this entire issue
#4
follow-up:
↓ 5
@
12 months ago
- Component changed from Database to Editor
- Keywords move-to-github close added
If the problem is in the register_block_core_footnotes_post_meta() function, that will need to be changed in the Gutenberg plugin first.
Could you open an issue in the Gutenberg repository?
https://github.com/WordPress/gutenberg/issues/new/choose
#5
in reply to:
↑ 4
@
12 months ago
Replying to sabernhardt:
If the problem is in the register_block_core_footnotes_post_meta() function, that will need to be changed in the Gutenberg plugin first.
Could you open an issue in the Gutenberg repository?
https://github.com/WordPress/gutenberg/issues/new/choose
Sorry, i don't understand, i'm not familiar with this. The code is not in a plugin, it's in wp-includes/blocks/footnotes.php. Do i have to create an account and make a new ticket on github because this code is not considered as a wordpress core ? sorry i'm confused.
#6
@
12 months ago
Hi @kamago
Thanks for raising the ticket.
The code is part of Gutenberg (https://github.com/WordPress/gutenberg), which is also part of WordPress Core but developed separately. I can open the issue in the Gutenberg repository with the details, but I'm currently unable to reproduce the problem. Please find the attached recording.
https://drive.google.com/file/d/1-AhTeIkK3Yj8WmuB_ITWRVuQGFVCBH3V/view
Could you please share more details to help reproduce the issue?
#7
@
12 months ago
Hi @karthikeya01
Thank you for your attention.
When i do like you, it's ok because the editor didn't refresh.
But then i do :
- i reload the editor (with F5 or loading from the post menu in wordpress),
- i add a new footnote anywhere
- i save the post
- in the preview, the new number appear in the text, but the new footnote doesn't appear at the bottom.
I can make a video like you did if you prefer. Hope that help.
#8
@
12 months ago
Yes, sharing a screencast would be helpful, though I don’t think refreshing the editor without saving it is a good workflow.
I think the issue you’re facing is due to local autosave, which helps restore edits if the network is down. However, it doesn’t store meta fields (footnotes also use meta fields); it only stores the post title, excerpt, and content.
#9
@
12 months ago
Hi @karthikeya01,
i don't refresh the editor without saving. What i meant was the problem occur when you try to add more footnotes after saving the first time.
You can find a screencast of the problem :
https://drive.google.com/file/d/1zLrxKxjs1m01gLb-bDhzjZdzQ1DlXvxb/view?usp=sharing
My concern is that, as i said in earlier comments, when i change the data in table postmeta with phpmyadmin, the footnotes load correctly, so it's not a navigator or cache issue, the data are there, but wrong ones are loaded (only if we already have "old" footnotes on the post), as you can see in the video. Maybe it's another problem, but i can't see others things apart from the database.
Sorry for my english, i'm trying my best lol.
#10
@
12 months ago
Hi @karthikeya01,
i tried to reproduce the problem on a fresh install, I installed the same theme, the same plugins, and it doesn't happen.
So it seems it's specific on my wordpress, not on the code from gutenberg, but i can't figure where to search from now.
Sorry for the bother, i'll try to find and report here if there's a solution.
#11
@
12 months ago
When i save a post, it makes 2 revisions, one which is correct, and one more with the original footnotes. I can show the revisions, select the one before, and it works. I don't understand why it does this.
It is like a code is removing footnotes without reference and force a new save with cleaned footnotes (althought the footnotes have good references, they are just new).
#12
@
12 months ago
This might be the same issue reported on https://github.com/WordPress/gutenberg/issues/54653
If you go to Preferences in the Options menu, uncheck Custom fields (Champs personnalisés), and reload the editor, will it update footnotes properly?
#14
@
12 months ago
Hi @sabernhardt,
Yes, that's exactly the same issue (https://github.com/WordPress/gutenberg/issues/54653).
What relief, Thank you very much everybody, sorry for the bothering.
To go further, i just tried to modify the footnotes, save my post (with original id 1574).
I reloaded the post, the footnotes were broken.
I went to phpmyadmin, on the
postmetatable, to the lastmeta_idline :I copied the
meta_valueon this line and pasted inmeta_valueon the line with originalpost_id(1574) :I reloaded my post again in wordpress, and it worked, the footnotes were working.
There's more than a hundred lines with wrong
post_idin the table, because of the automatic incrementation ofpost_ideverytime we save a post with footnotes. At least, this doesn't seem to conflict with any other post, but it sure creates unnecessary lines (and break footnotes).