• Resolved justin.voelker

    (@justinvoelker)


    Last time I came to these forums it was extremely helpful so I’m going for a second try.

    I am creating a wordpress site that will have a demo where people can login, play around, delete/add anything they want but after an hour, a cronjob will run that sets it all back to normal. The way I thought to do this was to create a demo site, and a demo-clean site (which never changes, just serves as a starting point for the copy each hour). The cronjob takes deletes everything from the demo directory and copies every file from the demo-clean directory back in. The database tables are all copied as well with changes made to the wp_usermeta, wp_posts, and wp_options tables to update the URL from the demo-clean subdomain to the demo subdomain.

    Firstly, is this the best way to do this or does anyone else have any suggestions on an easier way to accomplish a “reset eeverything on the site (files and database) back to a baseline every X-hours?”

    Secondly, my approach seems to work with one caveat; I cannot add new posts or new pages–I get a 404. There may be other things missing that I haven’t seen yet but I think that’s it (and it seems as though after a while of playing around the permalink settings page will show up blank indicating another problem). I have compared the database tables of the demo-clean site and the demo site and the only differences are the URLs in various spots.

    I sure hope someone knows why I get these strange quirks when copying the site (or better yet has a simpler/better way of creating a “playground” site that can be reset)

    As always, thank you www.remarpro.com community!

Viewing 1 replies (of 1 total)
  • Thread Starter justin.voelker

    (@justinvoelker)

    After a lot of trial and error and nearly 20 fresh installs of WordPress I found the issue (although I’m not sure why it is an issue). Making a copy of every single website file creates no problems. It is copying the database that creates the problem. I even narrowed it down the the “wp_posts” table. For some reason, when I DROP and CREATEthat table as a copy from my ‘clean’ site, I cannot create new posts or pages. When I restore the original table, I can create posts/pages just fine. Rather than using DROP then CREATE if I use TRUNCATE then INSERT INTO the wp_posts table keeps whatever special properties it had and everything seems to work. Not sure why that is happening but until I find a better way I’ll stick with what I have now.

Viewing 1 replies (of 1 total)
  • The topic ‘Copied site to new subdomain – Cannot add new post or page’ is closed to new replies.