# Implementing wp\_get\_environment\_type()

**URL:** <https://community.kinsta.com/t/implementing-wp-get-environment-type/1627>\
**Category:** Community Guides\
**Created:** [July 19, 2022, 7:36pm UTC](https://community.kinsta.com/t/implementing-wp-get-environment-type/1627 "2022-07-19T19:36:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![natasha\_nightshift](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/natasha_nightshift/32/652_2.png) [@natasha\_nightshift](https://community.kinsta.com/u/natasha_nightshift)\
**Post date:** [July 19, 2022, 7:36pm UTC](https://community.kinsta.com/t/implementing-wp-get-environment-type/1627/1 "2022-07-19T19:36:08Z")

</div>

After seeing that Kinsta has implemented the GET ENVIRONMENT function, I’m trying to include it in my project for the first time! 🙂

I would like to wrap a snippet of code, that only shows Google Analytics, if the code is on production so that my data is not skewed.

When I add `wp_get_environment_type()` to my local site, it tells me it’s ‘production’ though? Should this not be indicating it is local automatically? Or am I missing a step?

**Resources:**

- ([Implementing the New wp\_get\_environment\_type() Function at Kinsta](https://kinsta.com/feature-updates/wp_get_environment_type-function/))

**Screenshot:**

 ![Screen Shot 2022-07-19 at 3.36.51 PM](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/7/7b4fb56fb4b993bc32bddbcdfede7466bb02f4a7.png)  
 ![Screen Shot 2022-07-19 at 3.37.16 PM](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/2/2cf9339ed3a4f06a6cba66e3179468004eec172d.png)

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/kevin/32/808_2.png) [@Kevin](https://community.kinsta.com/u/Kevin)\
**Post date:** [July 19, 2022, 11:57pm UTC](https://community.kinsta.com/t/implementing-wp-get-environment-type/1627/2 "2022-07-19T23:57:05Z")

</div>

Hi @natasha_nightshift, thanks for reaching out! So that change was exclusively for MyKinsta. I do not believe the DevKinsta containers/servers contain the same fix. You can make that as a [Feature Request](https://community.kinsta.com/c/feature-requests/6), though!

It’s pretty easy to manipulate that value with something like this to your wp-config.php (I just quickly wrote/tested this but it’s a good starting point):

```auto
if (preg_match("/.*\.local$/", $_SERVER['HTTP_HOST'])){
	define( 'WP_ENVIRONMENT_TYPE', 'staging' );
}

```

That will only change the variable for the .local URL/won’t affect anything once you Push the site to Kinsta Staging or Staging to Live.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/8/80f8c4e56fecc02327a0964e6bf63a716483529f.png) [@system](https://community.kinsta.com/u/system)\
**Post date:** [October 17, 2022, 11:57pm UTC](https://community.kinsta.com/t/implementing-wp-get-environment-type/1627/3 "2022-10-17T23:57:28Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
