My Question: Is there some simple function i can use to duplicate a post with a php code, so for example every time someone enters a specific page it will duplicate a given post?

More details: I have a site with front-end posting / editing options. now i want to approve post edits before there are published.

One way to do that is to set the post status to draft when ever it is edited - but then until i approve it it is not shown on the site.

Another way is to display the pervious revision of the post until i approve the edit - but that's very complicated and will make me update my site code every now and then because there is this stupid issue with revisions not saving custom fields...

So i thought when ever a user edit a post it will create a duplicate post (before the new edit is saved) and then display that one on the site until i approve the new edit (then it will delete this duplicated post) - that will be very easy to do if ill found a way to duplicate a post with php :)

  • have you tried using plugins? Search for "duplicate post". I don't get your use case, but in there you can find the code you need.
    – prosti
    Nov 30 '16 at 16:10
  • I think the "Revisionary" plugin will do what you need.
    – WebElaine
    Nov 30 '16 at 16:56
  • I think you didn't really read the question.
    – Ben
    Dec 4 '16 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.