Note that you should be able to map domains without 3rd party plugins.
Here’s an untested suggestion for your callback in your current situation:
global $wpdb;
// Nothing to do if not multisite
if( ! is_multisite() )
return;
// Define the custom table
$wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
// Check if the custom table exists
if ( $wpdb->dmtable != $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->dmtable}'" ) )
return;
// Check if current site is mapped
$domain_exists = (bool) $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(blog_id)
FROM {$wpdb->dmtable}
WHERE blog_id = %d AND active = 1 LIMIT 0,1",
get_current_blog_id()
)
);
if( $domain_exists )
{
// do something
}
Related Posts:
- How to use WordPress Multisite With Different Domain Names?
- Anyone figured out how to use WordPress MultiSite with Domain Mapping & SSL?
- Can a multisite’s blogs be accessible from two different sub-domains?
- WP Multisite development with Mamp Pro and wildcard subdomains, not really working for me
- Domain mapping (without plugin) in 4.5.x multisite?
- Multisite Domain Mapping with SSL
- How to set up wordpress domain mapping on MAMP Pro
- How to use alias domain for multisite installation?
- WordPress Multisite with multiple domains using Nginx
- Steps for Moving Multiple WordPress Installs to a Multisite Install?
- Multisite posts in categories on network
- find a random blogid across my multisite network that has at least one post published
- MU domain mapping login issue
- sunrise.php for multi-network install of domain mapping plugin
- Infinite loop problem with the WordPress MU Domain Mapping plug-in
- WPDB Multiple site’s posts and get featured images
- Is it still only possible to do multisite domain mapping with a plugin in WordPress 4.1?
- How to manage multiple domain with different languages on each domain with single wordpress installation?
- “Preview Changes” button doesn’t show changes for previously published posts/pages
- How to add new sites and map a custom domain in WordPress Multisite?
- WordPress multisite with different domain
- Changing Multisite URL after the subsite has been in use
- Trying to migrate a WordPress Multisite with Domain Mapping
- Multiple blogs, different domain names, one install to rule them all
- W3 Total Cache – How to disable “Performance” menu under multisite? [closed]
- Hide root site in Multisite install
- Creating a Post form outside of the Admin
- How do I use different domain for subdomains in WP Multisite?
- subdomain mulitsite on localhost in a subfolder
- WordPress Network for regional company websites
- How to do Domain Mapping to Subdirectories?
- Possible to create a multisite network where the main site is non-WP?
- Using $wpdb Class to Pull Recent Comments Across a Network
- How do I park secure.primary.com on top of the multisite ID:1 domain: www.primary.com (primary multisite domain)
- Multiple domains with different child themes on one installation?
- WordPress MU Domain Mapping Customizer Error
- Changing admin sub-domain in WordPress multisite
- Why are images uploaded to main domain, when using multisite with different domains?
- How to order by blog ID in this multisite ‘List Blogs’ custom function
- WordPress multisite with multiple parent domains
- WP 4.4 – domain mapping for sites within a multisite network?
- How to Redirect login User with Mapped Domiain Primary blog Url to Original Sub-site Url
- WP MU – Accessing ‘Domain-Mapped’ WP-Admin with a subdomain
- Bootstrapping WordPress MultiSite Outsite of WordPress – No $wpdb
- WP Multisite – domain mapping to domain.com and separate site to domain.com/help
- Child Site doesn’t appear in the Network menu
- Create rewriterules for different domains in htaccess file with WP multisite
- Retrieving multisite blog IDs, somehow failing to foreach them properly
- Multisite domain naming
- Network Plugin Creating Pages for Different Subdomains
- How to host blog on separate domain from main site
- Optimizing Query used for a Shortcode
- WordPress MU Domain Mapping Just Redirects to Main Site
- Migrating wordpress multisite and domain mapping plugin
- WordPress Multisite domain mapping with different IPs
- WordPress Multisite Strange Redirect on Primary Site
- WordPress Multisite with Addon Domains (not parked domain) [closed]
- Use WordPress MultiSite (WPMS) with a remote database for each created site
- Mapping domains to WordPress network installed on subdomain
- WordPress 4.5+ Multisite Domain Mapping
- Link structure, WordPress IIS
- Multisite – Parent site with Polylang with different domains for each language [closed]
- Viewing / Editing A Multisite website after domain has expired
- WordPress Multisite + Erros with URLS and ADMIN
- How can I use separate domains for single pages?
- Login problems on multisite installation with different domains
- Is this a job for WP MultiSite with domain mapping plugin?
- MU/Subdomains + Domain Mapping + SSL?
- network site domain mapping still applied after being removed
- How to set up wordpress domain mapping on MAMP Pro
- Domain Mapping for WordPress MU and https redirection – How to?
- Canonical Resource URLs Across a Multisite Network 2012?
- How to display users with posts published between two dates (Sorted by Post-Count) [Multisite]
- Multisite domain mapping breaks CSS
- WordPress MU subdomain vhost
- Domain mapping with Multisite links are wrong
- Changed sub-site to its own domain trigger 302 redirects for all page links
- How to Deny Access to No Referrer Requests on Multiste with Mapped domains
- Install multisite wordpress on a subdomain and map to top level domains
- Multisite – One Site with multiple URLs
- Sub-sub folders of WordPress Multisite subdirectory
- Different Domains in Multisite Setup
- How to use the sunrise.php script for Multisite network domain mapping?
- Multisite on single wordpress
- WordPress Multisite with subdomains on different domains
- WordPress multisite with domains and subdomains
- Domain Mapping subsites of an Add-on Mulsite Domain
- Change WordPress Multisite Domain
- Multi-site site nav, wpdb->prepare missing argument
- Forward and mask a WordPress website
- WP MS: How to query over the network
- Folder structure when using multiple domains with WordPress
- Infamous admin login redirect
- How to Force WWW. in Domain With WordPress MU Domain Mapping Plugin?
- wordpress multisite domain mapping redirects to original subdomain
- WP-Cli Error When Mapping Multisite Subdomain
- WordPress Multisite and how to apply sef urls only to specific sites
- Change main site / network admin site?
- multisite installed on subdomain now want another subsite on subdirectory
- Migrating from domain mapping plugin to native domain mapping