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

WordPress will store post metadata in wp_postmeta table at the time of Autosave. #37060

Closed
dipankardipu123 opened this issue Dec 2, 2021 · 2 comments
Labels
[Feature] History History, undo, redo, revisions, autosave. [Feature] Saving Related to saving functionality [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@dipankardipu123
Copy link

Can anyone suggest me is there any way we will store metadata in wp_postmeta table. at the time of autosave.
Currently i am using below code:

_> subscribe(() => {

const wasAutosavingPost = select('core/editor').isAutosavingPost();
if (wasAutosavingPost) {
if (select('core')._experimentalGetDirtyEntityRecords().length > 0) {
const intervalId = setInterval(() => {
if (select('core/editor').isAutosavingPost() === false) {
dispatch('core/editor').savePost();
clearInterval(intervalId);
}
}, 100);
}
}

Using this code its created new revision in wp database, But I need proper solution.

  1. currently i am using all custom blocks.
  2. its create new revision if modify any changes on editor.

Requirement:

  1. instead of create new revision it will store all metadata in postmeta table at the time of autosave.
@dipankardipu123 dipankardipu123 changed the title Autosave trigger metadata store on wp_postmeta table WordPress will store post metadata in wp_postmeta table at the time of Autosave. Dec 2, 2021
@annezazu annezazu added [Type] Help Request Help with setup, implementation, or "How do I?" questions. [Feature] History History, undo, redo, revisions, autosave. [Feature] Saving Related to saving functionality labels Dec 15, 2021
@hj-collab
Copy link

@dipankardipu123 Can you properly format your code? Some code seem to be cut off here.

@Mamaduka
Copy link
Member

This is a duplicate of #16006. The post revisions currently do not support post meta.

Track ticket: https://core.trac.wordpress.org/ticket/20564.

@Mamaduka Mamaduka added the [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed label Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] History History, undo, redo, revisions, autosave. [Feature] Saving Related to saving functionality [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

4 participants