WebOps

Design & Strategy

We start with your goals and how your team works, then design the platform to match.

Website Builds

Custom Drupal, WordPress, and headless builds that perform from day one and stay easy to run.

Migrations

High-stakes CMS migrations from virtually any source onto a platform we support, with content and uptime protected.

Maintenance & Support

Proactive, senior-led care that keeps your platform secure, fast, and ready for what comes next.

AI Integration

Practical, native AI features built by the team contributing to Drupal’s AI core.

WebOps Audits

A clear, prioritized picture of your platform’s health and exactly what to fix first.

RevOps

CRM Implementation

HubSpot implementation built around how your team sells. We scope what is actually needed, configure what your team can operate, and hand off a system that works on day one.

CRM Migrations

Marketo, Eloqua, Pardot, and Salesforce moves into HubSpot. We treat every migration as a risk mitigation project, because for the VP who owns the pipeline, it is.

CRM Architecture

The structural decisions that shape everything downstream: object relationships, data governance, integration strategy, and managed data migration. Designed for how your team actually works.

Insights

Articles

Practical thinking on WebOps, RevOps, and running platforms that cannot fail.

Newsletter

Occasional, useful notes from the people doing the work. No noise.

Events & Talks

Where to find our team, from DrupalCon to industry meetups and webinars.

Our Work

About

Our Story

Why Digital Polygon exists, and the through-line behind every engagement.

Team & Leadership

The senior, global team you actually work with, named and accountable.

Careers

Join a senior team that builds the platforms and revenue systems people depend on.

Open Source

The modules we maintain, the initiatives we lead, and Polymer, our WebOps product.

Managing Environment Based Configurations with WordPress

Establishing consistency in the configuration settings across different environments (e.g., local, development, testing, production) is essential for ensuring a stable and reliable system. At the same time, the ability to cater to specific requirements of each environment is crucial to achieve optimal performance and functionality. Example Use Case: Email Delivery on Non-Production Environments Have you…

Managing Environment Based Configurations with WordPress

Establishing consistency in the configuration settings across different environments (e.g., local, development, testing, production) is essential for ensuring a stable and reliable system. At the same time, the ability to cater to specific requirements of each environment is crucial to achieve optimal performance and functionality.

Example Use Case: Email Delivery on Non-Production Environments

Have you ever had an experience where your website sent emails to users unexpectedly? After spending a few hours debugging why this duplicate email or “TESTING” email went out, you realize that someone forgot to make a change to the email plugin routing when you pulled down the database from production?

While you should certainly add DB sanitization scripts to your automations, setting up configurations to ensure emails are rerouted on non-production environments can be very helpful. In a production environment, outgoing emails should go to real users while in non-production environments, emails shouldn’t be sent to real users.

An Approach for Environment Based Configuration in WordPress

WordPress has a concept of Must Use Plugins (a.k.a mu-plugins). Must-use plugins are plugins installed in a special directory inside the content folder which are automatically enabled on all sites in the installation. These plugins can be used to control configurations and settings within your WordPress website and can be leveraged to configure settings on a per-environment basis giving you the ability to quickly and easily adjust configurations for prod vs. non-prod environments. 

In an example of a mu-plugin below, the wp-reroute-email plugin will be activated and configured on non-production environments. In order to leverage this:

  1. Create a `environment-config.php` under `wp-content/mu-plugins` directory
  2. Use wp_get_environment_type()  to identify the environment.
  3. Enable/disable the plugin based on the environment type.
  4. add_filter can be utilized to change configurations based on the environment.

Please refer to the below piece of code:

<?php

require_once(ABSPATH . 'wp-admin/includes/plugin.php');

# List Development Plugins
$plugins = [
 'wp-reroute-email/wp-reroute-email.php'
];

if (wp_get_environment_type() !== "live") {
 // Enable wp-reroute-email plugin.
 foreach ($plugins as $plugin) {
   if(is_plugin_inactive($plugin)) {
    activate_plugin($plugin);
   }
 }
 // Update plugin configuration to set a rerouting email.
 add_filter( 'pre_option_wp_reroute_email_enable', '__return_true' );
 add_filter( 'pre_option_wp_reroute_email_address', '__return_reroute_email_address' );
}
else {
 // This will ensure wp-reroute-email is always disabled.
 foreach ($plugins as $plugin) {
   if(is_plugin_inactive($plugin)) {
    deactivate_plugins($plugin);
   }
 }
 add_filter( 'pre_option_wp_reroute_email_enable', '__return_false' );
}

/**
* Set a rerouting email address.
*/
function __return_reroute_email_address(): string {
 return '[email protected]';
}

Reference:

Keep reading

More from the field.

For projects that cannot fail

When it has to work. We deliver.

Tell us what you are working on. We will tell you honestly whether we are the right fit, and what a strong engagement looks like.