WordPress Development How to Set Up a Staging Environment / WordPress

Usually we will start developing a website in a local server. Then we upload it staged and after everything is confirmed we push the site to live server. As simple as it sounds, developing a website It can be a very long process.

In this article we will see How to effectively deploy and configure these stages when developing for WordPress using a handy plugin called WP Local Toolbox.

When the plugin is activated, it will display some PHP constants. To name but a few, these constants will tell us if we are currently in a live site or in the local sitemake sure the plugin is not needed in certain period still disabledand notify us when New content has been added in the live site.

Development stage

This is where we start. We build our website in a localhost: a web server running in our computer. If you’re using OS X, you can easily set up a MAMP. Windows users have a few more options like MAMP (for Windows), WAMP and XAMPP.

At this stage you can use development tools like Codekit and Grunt or Gulp. You can work together with your colleagues using Git version control; you are also free to do some trial and error safely along the way.

During the development phase, I encourage you to activate WP_DEBUG and to install some WordPress plugins like Query Monitor, RTL Checker and User Conversion in addition to the plugins we will implement in the live site. A few additions are meant to create conditions for development as checking process. That said, we will not be activating these plugins at the staging site or live.

Read More:   Top 10 Gluten Free Magazines & Publications To Follow in 2021

Open wp-config.phpand add the following line định nghĩa ('WP_DEBUG', đúng);.

 định nghĩa ('WP_DEBUG', đúng); định nghĩa ('WPLT_SERVER', 'dev'); 

This line marks our WordPress installation in localhost as “development”. When you login to your WordPress dashboard, you will see that the Admin bar, by default, now returns blue with the server stated as MÁY CHỦ DEV.

Put it nhà phát triển enable the “Discourage search engines from indexing this site” option to prevent the site from being accidentally indexed in Search Engines, even though it is only accessible in their computers I.

If you don’t like the default green you can always change it by specifying WPLT_COLOR. The color can be specified with the color keyword or with the Hex format as shown below.

 xác định ('WPLT_COLOR', '# 7ab800'); 

In addition, you may also want to deactivate a few plugins that are not needed during development, like the archive plugin, backup plugin, and Akismet.

To do so, specify each plugin in an array with WPLT_DISABLED_PLUGIN.

 định nghĩa ('WPLT_DISABLED_PLUGINS', tuần tự hóa (mảng ('w3-Total-cache / w3-Total-cache.php', 'akismet / akismet.php',))); Â 

“Staging” Stage

The “staging” site is where we test our site. Ideally in an environment closely imitated (content, server specification, etc.) live website at order to catch bugs and errors which we may have missed in the development phase.

The website can usually only be accessed by a few people, including customers, to show them the final version of the website.

Some plugins are better deactivated, such as the ones we used in the development phase, the archive plugin, and the backup plugin. The staging site can be placed in a subdomain, for example, staging.coolsite.com or in a separate domain name like coolsitestaging.com.

We define staging site in wp-config.php as follows.

 định nghĩa ('WP_DEBUG', đúng); xác định ('WPLT_SERVER', 'thử nghiệm'); định nghĩa ('WPLT_DISABLED_PLUGINS', tuần tự hóa (mảng ('w3-Total-cache / w3-Total-cache.php', 'akismet / akismet.php', 'debug-bar / debug-bar.php', 'debug-bar -extender / debug-bar-extender.php ',' debug-bar-console / debug-bar-console.php ',' Simply-show-ids / Simply-show-ids.php ',' monster-widget / monster -widget.php ',' theme-check / theme-check.php ',' wordpress-beta-test / wp-beta-tests.php ',))); 

Now we set the server as dàn dựng or thử nghiệm. The admin bar color should now turn orange.

Read More:   Top 10 Mashable RSS Feeds

At this stage we can also deactivate a few plugins we use for development. We keep a few other developer plugins enabled and WP_DEBUG enabled because we need to catch errors while testing in staging server.

Live stage

This is the final stage where we publish our website in a live server and allow anyone and anyone to view the website. During this period, we should also deactivate all plugins for development and finally enable caching and backup among other things.

 định nghĩa ('WP_DEBUG', sai); định nghĩa ('WPLT_SERVER', 'live'); định nghĩa ('WPLT_DISABLED_PLUGINS', tuần tự hóa (mảng ('developer / developer.php', 'debug-bar / debug-bar.php', 'debug-bar-extender / debug-bar-extender.php', 'debug-bar -console / debug-bar-console.php ',' Simply-show-ids / Simply-show-ids.php ',' tái tạo-hình thu nhỏ / tái tạo-hình thu nhỏ.php ',' viết lại quy tắc-thanh tra / viết lại quy tắc -inspector.php ',' rtl-test / rtl-tests.php ',' user-switching / user-switching.php ',' monster-widget / monster-widget.php ',' theme-check / theme-check .php ',' truy vấn-màn hình / truy vấn-màn hình.php ',' wordpress-beta-thử nghiệm / wp-beta-thử.php ',))); 

Live stage admin bar default red (this can be changed). Follow new content in live server to keep the test server database updated with new content like in the live server; it will help to check more accurately and make sure that the new content is displayed OK.

Add the following line to the live server wp-config.php do like that.

 xác định ('WPLT_NOTIFY', '[email protected]'); 

Once set, we will receive email notifications when our clients add new content (posts and pages) to the live server. When they do, copy the content database from directly.

If your thử nghiệm and trực tiếp the server is hosted in the same server, go to phpMyAdmin. Then choose wp_posts database and select Work navigation. In Copy table to (database) box, select the staging site database and make sure that Add DROP TABLE option is checked so it will overwrite existing database.

Read More:   Top 10 Hawaii Travel Blogs & Websites To Follow in 2021

That’s it, now we have nicely organized stages for developing a WordPress website. I realize that many of you have your own working style, so feel free to share your best practices when trading “staging”, and the tools you are using.

Last, Ched All sent you details about the topic “WordPress Development How to Set Up a Staging Environment / WordPress
❤️️”.Hope with useful information that the article “WordPress Development How to Set Up a Staging Environment / WordPress
” It will help readers to be more interested in “WordPress Development How to Set Up a Staging Environment / WordPress
[ ❤️️❤️️ ]”.

Posts “WordPress Development How to Set Up a Staging Environment / WordPress
” posted by on 2023-01-17 07:11:15. Thank you for reading the article at Chedall.com

Check Also
Back to top button