wp_initial_constants

Defines initial WordPress constants.

Description

wp_initial_constants(); 

Usage

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

Defined (1)

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

/wp-includes/default-constants.php  
  1. function wp_initial_constants() { 
  2. global $blog_id; 
  3.  
  4. /**#@+ 
  5. * Constants for expressing human-readable data sizes in their respective number of bytes. 
  6. * @since 4.4.0 
  7. */ 
  8. define( 'KB_IN_BYTES', 1024 ); 
  9. define( 'MB_IN_BYTES', 1024 * KB_IN_BYTES ); 
  10. define( 'GB_IN_BYTES', 1024 * MB_IN_BYTES ); 
  11. define( 'TB_IN_BYTES', 1024 * GB_IN_BYTES ); 
  12. /**#@-*/ 
  13.  
  14. $current_limit = @ini_get( 'memory_limit' ); 
  15. $current_limit_int = wp_convert_hr_to_bytes( $current_limit ); 
  16.  
  17. // Define memory limits. 
  18. if ( ! defined( 'WP_MEMORY_LIMIT' ) ) { 
  19. if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) { 
  20. define( 'WP_MEMORY_LIMIT', $current_limit ); 
  21. } elseif ( is_multisite() ) { 
  22. define( 'WP_MEMORY_LIMIT', '64M' ); 
  23. } else { 
  24. define( 'WP_MEMORY_LIMIT', '40M' ); 
  25.  
  26. if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) { 
  27. if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) { 
  28. define( 'WP_MAX_MEMORY_LIMIT', $current_limit ); 
  29. } elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /** = 256M */ ) { 
  30. define( 'WP_MAX_MEMORY_LIMIT', $current_limit ); 
  31. } else { 
  32. define( 'WP_MAX_MEMORY_LIMIT', '256M' ); 
  33.  
  34. // Set memory limits. 
  35. if ( -1 !== $current_limit_int && ( -1 === $wp_limit_int || $wp_limit_int > $current_limit_int ) ) { 
  36. @ini_set( 'memory_limit', WP_MEMORY_LIMIT ); 
  37.  
  38. if ( ! isset($blog_id) ) 
  39. $blog_id = 1; 
  40.  
  41. if ( !defined('WP_CONTENT_DIR') ) 
  42. define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down 
  43.  
  44. // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development. 
  45. if ( !defined('WP_DEBUG') ) 
  46. define( 'WP_DEBUG', false ); 
  47.  
  48. // Add define('WP_DEBUG_DISPLAY', null); to wp-config.php use the globally configured setting for 
  49. // display_errors and not force errors to be displayed. Use false to force display_errors off. 
  50. if ( !defined('WP_DEBUG_DISPLAY') ) 
  51. define( 'WP_DEBUG_DISPLAY', true ); 
  52.  
  53. // Add define('WP_DEBUG_LOG', true); to enableerrorlogging to wp-content/debug.log. 
  54. if ( !defined('WP_DEBUG_LOG') ) 
  55. define('WP_DEBUG_LOG', false); 
  56.  
  57. if ( !defined('WP_CACHE') ) 
  58. define('WP_CACHE', false); 
  59.  
  60. // Add define('SCRIPT_DEBUG', true); to wp-config.php to enable loading of non-minified,  
  61. // non-concatenated scripts and stylesheets. 
  62. if ( ! defined( 'SCRIPT_DEBUG' ) ) { 
  63. if ( ! empty( $GLOBALS['wp_version'] ) ) { 
  64. $develop_src = false !== strpos( $GLOBALS['wp_version'], '-src' ); 
  65. } else { 
  66. $develop_src = false; 
  67.  
  68. define( 'SCRIPT_DEBUG', $develop_src ); 
  69.  
  70. /** 
  71. * Private 
  72. */ 
  73. if ( !defined('MEDIA_TRASH') ) 
  74. define('MEDIA_TRASH', false); 
  75.  
  76. if ( !defined('SHORTINIT') ) 
  77. define('SHORTINIT', false); 
  78.  
  79. // Constants for features added to WP that should short-circuit their plugin implementations 
  80. define( 'WP_FEATURE_BETTER_PASSWORDS', true ); 
  81.  
  82. /**#@+ 
  83. * Constants for expressing human-readable intervals 
  84. * in their respective number of seconds. 
  85. * Please note that these values are approximate and are provided for convenience. 
  86. * For example, MONTH_IN_SECONDS wrongly assumes every month has 30 days and 
  87. * YEAR_IN_SECONDS does not take leap years into account. 
  88. * If you need more accuracy please consider using the DateTime class (https://secure.php.net/manual/en/class.datetime.php). 
  89. * @since 3.5.0 
  90. * @since 4.4.0 Introduced `MONTH_IN_SECONDS`. 
  91. */ 
  92. define( 'MINUTE_IN_SECONDS', 60 ); 
  93. define( 'HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS ); 
  94. define( 'DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS ); 
  95. define( 'WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS ); 
  96. define( 'MONTH_IN_SECONDS', 30 * DAY_IN_SECONDS ); 
  97. define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS ); 
  98. /**#@-*/