ms_subdomain_constants

Defines Multisite subdomain constants and handles warnings and notices.

Description

ms_subdomain_constants(); 

VHOST is deprecated in favor of SUBDOMAIN_INSTALL, which is a bool.

On first call, the constants are checked and defined. On second call, we will have translations loaded and can trigger warnings easily.


Usage

  1. if ( !function_exists( 'ms_subdomain_constants' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-default-constants.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ms_subdomain_constants(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-default-constants.php  
  1. function ms_subdomain_constants() { 
  2. static $subdomain_error = null; 
  3. static $subdomain_error_warn = null; 
  4.  
  5. if ( false === $subdomain_error ) { 
  6. return; 
  7.  
  8. if ( $subdomain_error ) { 
  9. $vhost_deprecated = sprintf( 
  10. /** translators: 1: VHOST, 2: SUBDOMAIN_INSTALL, 3: wp-config.php, 4: is_subdomain_install() */ 
  11. __( 'The constant %1$s <strong>is deprecated</strong>. Use the boolean constant %2$s in %3$s to enable a subdomain configuration. Use %4$s to check whether a subdomain configuration is enabled.' ),  
  12. '<code>VHOST</code>',  
  13. '<code>SUBDOMAIN_INSTALL</code>',  
  14. '<code>wp-config.php</code>',  
  15. '<code>is_subdomain_install()</code>' 
  16. ); 
  17. if ( $subdomain_error_warn ) { 
  18. trigger_error( __( '<strong>Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL.</strong> The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting.' ) . ' ' . $vhost_deprecated, E_USER_WARNING ); 
  19. } else { 
  20. _deprecated_argument( 'define()', '3.0.0', $vhost_deprecated ); 
  21. return; 
  22.  
  23. if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) { 
  24. $subdomain_error = true; 
  25. if ( SUBDOMAIN_INSTALL !== ( 'yes' == VHOST ) ) { 
  26. $subdomain_error_warn = true; 
  27. } elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) { 
  28. $subdomain_error = false; 
  29. define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' ); 
  30. } elseif ( defined( 'VHOST' ) ) { 
  31. $subdomain_error = true; 
  32. define( 'SUBDOMAIN_INSTALL', 'yes' == VHOST ); 
  33. } else { 
  34. $subdomain_error = false; 
  35. define( 'SUBDOMAIN_INSTALL', false ); 
  36. define( 'VHOST', 'no' );