We just raised $735,000 to introduce the world to multi-tenant WordPress.

Communicate WPCS' DNS data to your customers

When your customers want to use a custom domain and they manage its DNS themselves, you’ll have to communicate WPCS’ DNS data somehow. One way of achieving this could be by sending them an e-mail from your own CRM. Another way, however, is to simply display the data in the tenant’s Dashboard! Here’s a quick and dirty way of getting WPCS DNS data to your customers.

Requirements

To create a Dashboard widget, we’ll use the Code Snippets plugin.

Display the DNS requirements

Let’s get straight to it and create a dashboard widget with the DNS data hardcoded. Add the following code as a PHP snippet:

<?php

add_action('wp_dashboard_setup', 'register_wpcs_dns_data_widget');
  
function register_wpcs_dns_data_widget() {
    global $wp_meta_boxes;

    // Add the widget, the second argument is the title of the widget
    wp_add_dashboard_widget('wpcs_dns_data_widget', 'Configure your domain', 'display_wpcs_dns_data');
}

function display_wpcs_dns_data() {
    echo "<p>Welcome!</p>";
    echo "<p>In order to use your own domain name for this website, configure your DNS in the following way:</p>";

    echo "<h3>For root domains:</h3>";
    echo "<p>Add <i>all</i> the following A records for your domain and remove any existing A records:</p>";
    echo "<div><input readonly style=\"margin-bottom:5px\" value=\"1.1.1.1\" /></div>";
    echo "<div><input readonly style=\"margin-bottom:5px\" value=\"1.1.1.1\" /></div>";
    echo "<div><input readonly value=\"1.1.1.1\" /></div>";
    echo "<br />";

    echo "<h3>For subdomains:</h3>";
    echo "<p>Add a CNAME record with the following value:</p>";
    echo "<div><input readonly value=\"public.example.wpcs.io\" /></div>";
}

CAUTION

The DNS values for custom domains are region-specific. Check the WPCS Console to see what the actual IP addresses and CNAME values should be for the region your product resides in. You can find this information on the tenant details screen.

NOTE

Don’t forget to enable the snippet and set it to Only run in administration area!

Related articles

Migrate to WPCS with WPCS Migration Plugin

You can get your sites up and running on the WPCS platform using our free WordPress Migration plugin

Build a Shopify SaaS Clone using WordPress, WooCommerce, WPCS & Kubernetes

Build a WPCS Product in 5 Steps

Build a scalable WordPress SaaS or WaaS (Website as a Service

How to automate your Website as a Service (WaaS) - Storefront included!

How to automate the sale and launch of your websites using a storefront with the WPCS API, WooCommerce, and Uncanny Automator.

Webinar: Merge Sites, Automate, and the Versioning System

Merging your agency’s website portfolio in WPCS where each website has a different tech stack, automate your business with a storefront, and continuously develop your sites like a SaaS.

Getting started with the WPCS Intro Series

Launch your WordPress SaaS in 5 easy steps

Importing A Site Using the WPCS CLI

Using LocalWP to install and build our local WP installation and send it to WPCS with the CLI

Plugin name

Author

Code Snippets Pro

Description

When your customers want to use a custom domain and they manage its DNS themselves, you’ll have to communicate WPCS’ DNS data somehow. One way of achieving this could be by sending them an E-mail from your own CRM. Another way, however, is to simply display the data in the tenant’s Dashboard! Here’s a quick and dirty way of getting WPCS DNS data to your customers.

Code Snippet