• Resolved rcwdm

    (@rcwgsy)


    We have a CPT were the posts can be edited by the logged in author. We need to approve the changes before placed it is placed live (published). The problem we are having is that the originally published post status changes to pending, so the post goes off the frontend until we review and publish it again.

    Is there anyway to keeping the current published post live until the edited (pending) post is approved, then replace the old version with the edited version?

Viewing 1 replies (of 1 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    Unfortunately the feature that would clone a post and then replace it once validated isn’t present natively in WordPress. However, you can take advantage of the native WP Post Revision. In fact, every post update (even when using the front-end form) create a new post revision, that becomes the newest “version”.

    In your case, you could use the acfe/form/submit_post action (see documentation) to hook in after the post update (and the post revision creation), to revert back to the previous “validated” post revision using wp_get_post_revisions() (see documentation), and restore that revision using wp_restore_post_revision() (see documentation).

    Then you’ll just have to check the post revisions in your WP Admin UI, to validate any new revision and apply the changes if needed.

    You’ll find some threads on this topic on Stackoverflow here and here for example.

    Hope it helps!

    Have a nice day!

    Regards.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.