It is a core WP function, but only after WordPress version 5.5.0.
If you’re using an older version of WordPress, it won’t exist yet.
Do this:
add_action('admin_init', function() {
if ( ! function_exists( 'wp_get_environment_type' ) ) {
return;
}
$environment = wp_get_environment_type();
//...
Or, better still, make sure your WordPress installation is up to date.
Related Posts:
- Auto Load Plugin Hooks inside Must Use Plugin
- How to use a Must-Use plugin to hide a regular one and to hide itself?
- register_activation_hook in mu-plugin not triggering
- Certain functions are undefined when called form mu-plugins
- Notice: Uninitialized string offset: 0 in social sharing mu-plugin
- How to update mu-plugin
- Are mu-plugins plugins still deployed via wordpress.org/plugins?
- Must use Plugin not updating HTML code in head
- How can woocommerce be used in mu-plugins folder?
- “Disable” specific plugins on certain pages
- Using mu-plugins on the Genesis Framework
- What Are the Advantages of Using an mu-plugin
- How to use a Must-Use plugin to hide a regular one and to hide itself?
- Define constant for one plugin in mu-plugin
- Unable to access WPadmin, website down
- Best way to overide plugin CSS?
- How to include a plugin’s php file to another plugin functions file [duplicate]
- How to register_sidebar() without messing up the order?
- How to find out if option exists but is empty?
- Template for different category on woocommerce product [closed]
- Reduce nonce lifespan
- Add Products to user’s ID Woocommerce
- Add_rewrite_rule doesn’t add custom url in plugin
- Fatal error: Uncaught Error: Call to undefined function get_userdata()
- Custom options page checkbox will not save, despite working with text
- How to add inline css/js inside a shortcode
- taxonomy_template filter do not loads custom taxonomy template properly
- Is this plugin being loaded before file.php, subsequently not allowing me to use certain functions?
- Where to place custom functions?
- Advanced Custom Fields/User Role Editor – how to hide ACF for certain users?
- Checking that the Rewrite API is available
- Im unable to login to my wordpress
- Serve different files depending on OS/Browser
- How to make a PDF/Document library [closed]
- Set Post Format if find a string in title or post content
- How to fetch form data and show it to my page?
- Add menu page issues (permissions & position)
- What is the best way for showing a grid of customer logos?
- Is there any way to make myself an admin?
- Plugin Theme CSS [closed]
- General questions re: WordPress and WP plugins [closed]
- populating a form field with output from a custom plugin function
- Using ‘mysqli_connect’ ‘crashes’ WordPress client-side
- Short messages widget [closed]
- Yoast Force Rewrite Crashed Site [closed]
- Fetch Data from other website in wordpress (screen scraping)
- Is there a way to add custom endpoint to specific page only
- IF condition based on wp_remote_get output
- shortcode not return any thing in Gutnburg
- Change in one place the data about the company, which are placed on several pages
- How do I add a plugin dependency to my customized theme?
- How WordPress core manage the plugin installation
- wp_trash_post hook – problem with page updating if using wp_die
- “Allowed memory size” problem [closed]
- rewrite file to wordpress
- WordPress Url setting
- When Installing a Plugin Where do I Move Template Files to?
- What would make the plugin update process to complete but don’t report as such?
- AZindex related help needed
- WordPress slider that allows image, headline, text, and button?
- Contact Form 7 is not redirecting the “Thank-You” page with the removal of CSS and JS of plugins
- WordPress search input in database, to edit information via form and update the database
- Remove a div class with condition
- How Can I Increase Breadcrumb Position Count (Starting From 2)?
- BS Authorize.net Problem (Payment in hanging if customers is not logged in)
- PHP Error message Upload images to remote server
- Better search on WordPress.org Plugins?
- Avoid duplicate posts with xml rpc
- No route was found matching the URL and request method
- WP_get_image_editor resizing images in a foreach loop
- WP core and plugin updates fail AWS
- Load my Inline js footer area
- CMB2 Output Select Box Chosen Option
- Custom product page’s style for printing
- Remove action added in plugin class from theme
- wc_get_product_terms() throws “Notice: Undefined offset: 0”
- Use WordPress Site For Email List Functionality
- How to add subdomain to htaccess
- Create a two column content
- Can’t get or display post thumbnail in wordpress
- Custom User Notice Upon Login
- How to validate field when create post
- Keeping original URL
- How to publish adobe edge animation to custom wordpress plugin
- Adding an onchange event to a custom dropdown menu in WordPress
- How to add jquery to my custom post type wp plugin
- WordPress list child pages of custom post type
- Update post meta not working on wp_postmeta
- Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
- Trouble Removing Plugin [closed]
- How to develop an extension for a simple form post and post back? [closed]
- Hide Pages WooCommerce [closed]
- What can I do to customize a widget provided with this plugin? from where have I to start?
- Javascript as Jquery Function Call?
- Shortcode inside a redirect [closed]
- Attachement title in wpallimport
- Block registration with viewScript
- Ajax Called in Plugin php file
- Store large dataset in WordPress installation temporary
- How to edit the name of a plugin on wordpress.org/plugins