最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - Wordpress Staging Site

programmeradmin1浏览0评论

Problem:

I do not want to develop (new features) of a wordpress site on production. So I set up an staging server where the same installation of wordpress is running on.

So while I develop on the staging server on new features, there is content added on production by some other users. Furthermore we use a page builder -> some design is also modified. (We also do some front-end work and using the page builder for some functionalities)

This means, that I cannot simply overwrite the production site with the staging site when the new features are ready - cause I would lose the content which was added (Primarily the ones in the database)

How can I achive that? So the key requirements are:

1) Developing on new features on staging

2) User can add content and change design (with page builder) on live

(I found similar questions, but none of them made me happy :/ )

Problem:

I do not want to develop (new features) of a wordpress site on production. So I set up an staging server where the same installation of wordpress is running on.

So while I develop on the staging server on new features, there is content added on production by some other users. Furthermore we use a page builder -> some design is also modified. (We also do some front-end work and using the page builder for some functionalities)

This means, that I cannot simply overwrite the production site with the staging site when the new features are ready - cause I would lose the content which was added (Primarily the ones in the database)

How can I achive that? So the key requirements are:

1) Developing on new features on staging

2) User can add content and change design (with page builder) on live

(I found similar questions, but none of them made me happy :/ )

Share Improve this question edited Sep 18, 2018 at 9:11 QuickSort asked Sep 18, 2018 at 9:02 QuickSortQuickSort 1614 bronze badges 4
  • 1 "best approach" questions are usually off-topic, as they are primarily opinion based. My opinion: Why does this matter? How are you developing functionality? You could put them in your custom theme/plugin and simply update that – kero Commented Sep 18, 2018 at 9:05
  • I forgot to mention, that we also use the page builder and create sites and so on on staging before giving it to prod. (I removed "best approach". I simply want a solution that works) – QuickSort Commented Sep 18, 2018 at 9:10
  • 1 What exactly do you mean that you cannot "overwrite the production site"? What else do you need to push there besides your code changes? – Hans Commented Sep 18, 2018 at 10:06
  • 1 The page builder makes changes in db. so that's the challenge to merge that together. – QuickSort Commented Sep 18, 2018 at 11:24
Add a comment  | 

2 Answers 2

Reset to default 0

I fear that there does not exist an answer that is going to make you happy. There is no (easy/good) solution for this problem. In most cases, the production (staging) environment does only touch the code (FTP-files) of a WordPress website, while the live version makes changes to the database (e.g. adding content to it). So normally, when you want to update the live version, you (Git) pull the new version of the website onto the server, and do not touch the database. Additionally, one could change some minor settings within WordPress manually, which will update the database.

However, in the particular case you describe, using Page Builder to develop new features/pages on the staging website, both the staging version and the live variant of the website are making changes to the database.

As far as I know, the only method to update the live website is to find out which database records are updated by Page Builder and add these to the live database manually. The only 'real' solution that I would know of is to create new features in the code itself, but I can see how this might not be a solution for you.

TL;DR: both variants (stage/live) make changes to the database, they have to be merged which is not trivial.

There are a couple of options here. One would be to create your own custom database table to store all the development features in. This way, you'd only be pushing that specific table from staging to prod.

Another option is to keep track of what records you're inserting into the staging database, and create a MySQL script to run that will copy the changes to production. As I'm sure you're aware, the media library is its own challenge, so my workaround there is that I normally upload new media directly to the production website and reference those images on staging. That way when I push the new posts from staging to prod, they already reference the correct image - live URL, correct db ID, and so forth.

发布评论

评论列表(0)

  1. 暂无评论