Skip to content

Commit

Permalink
Merge pull request #94 from humanmade/wp-env-type
Browse files Browse the repository at this point in the history
Define WP_ENVIRONMENT_TYPE
  • Loading branch information
roborourke authored Sep 8, 2020
2 parents 0dd5e47 + 99ade93 commit 47c21cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,18 @@ function fix_plugins_url( string $url, string $path, string $plugin ) : string {
return str_replace( dirname( ABSPATH ), dirname( WP_CONTENT_URL ), dirname( $plugin ) ) . $path;
}

/**
* Sets the WP_ENVIRONMENT_TYPE constant.
*
* @return void
*/
function set_wp_environment_type() : void {
if ( defined( 'WP_ENVIRONMENT_TYPE' ) ) {
return;
}
define( 'WP_ENVIRONMENT_TYPE', get_environment_type() );
}

/**
* Registers a module with the store.
*
Expand Down
3 changes: 3 additions & 0 deletions load.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
// Patch plugins URL for vendor directory.
add_filter( 'plugins_url', 'Altis\\fix_plugins_url', 10, 3 );

// Ensure WP_ENVIRONMENT_TYPE is set.
add_action( 'altis.loaded_autoloader', 'Altis\\set_wp_environment_type', -10 );

// Fire module init hook and load enabled modules.
add_action( 'altis.loaded_autoloader', function () {
/**
Expand Down

0 comments on commit 47c21cd

Please sign in to comment.