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
- is_singular() in mu-plugins not working
- Disable Plugin if not logged in
- Plugin – Admin menu page broken url
- Error with get_price (and others) in self-written plugin to show price
- Hide DIV if empty – Plugin Gallery
- Easy WP SMTP plugin test email failed
- How to modify or create custom contact form 7 select options [closed]
- How to update a local development plugin on a separate machine
- adding Adsense’s In-Article Ads between images of blog post
- How to Include Fields in Query String When Making Request of WordPress.org Plugin API?
- Custom plugin – load enqueue only for this plugin
- Export postmeta (custom fields)
- Creating a form and displaying entry data as a table
- Which filter/action should I use to serve content for “virtual” files
- Customizing a blog page layout
- Add “Featured Image” box in my plugin post page
- Error When Trying To Login [closed]
- Is it a standard to have an empty `index.php` in root of Plugin? [duplicate]
- unable to remove malware from wp website [closed]
- Sub Plugin deactivation when Parent Plugin deactivate
- Getting 400 Error: redirect_uri_mismatch when trying to grant permission to Gmail SMTP plugin
- How to change WooCommece variation data programmtically [closed]
- Managing wordpress Themes & plugins for multisite
- WordPress Fatal Errors [closed]
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- Chrome Dev Tools console says every page in my blog has link to http://maps.google.com [closed]
- Minimize and Uglify WordPress Plugin Files
- YOAST Seo xmlsitemap menu item not showing in the dashboard [closed]
- Regularity of Checking for plugin updates? [duplicate]
- How to include files relative to a file’s directory
- Change the number of plugins counted on wp-admin/plugins.php
- Translation issue with global variables
- How to redirect non www to www? [closed]
- Insert ads below the title
- .php file for woocommerce edit category? [closed]
- how do i change my website facebook login button to another text immediately user login? [closed]
- Advanced WordPress plugin activation detection
- WordPress Social Sharing Icons – Custom Placement
- Customize Menu | Styling LESS/SCSS code formats
- plugin uninstall function drop the tables, but shows errors on admin
- download button for audio file in post [closed]
- How to use template inside plugin shortcode with variables for big HTML code
- check uncategorized category by default
- Print posts category or tag as a formatted journal
- Woocommerce – WordPress Roles & Capabilities
- Get param from shortcode in plugin function
- Plugin scheduled event not working
- Trying to add_action in a loop
- Switch from wp-cron to a server cron job
- show my own admin_notices after a post has been published
- Play videos with buffering in my server
- Large amount image data transfer
- Advanced Custom Fields (acf) – Filter Relationship by Taxonomies not Post Type
- How to translate wordpress error message
- Sending customer an email with link to stripe to make payment
- Asynchronous request in wordpress
- Override a Plugin Function
- How to create wordpress page that lets users create their own quiz? [closed]
- wp_redirect not working on plugin
- Multiple authors and readers restricted by role [closed]
- shortcode – multiple instances of same parameter name in one shortcode instance
- dynamic name of the style for wp_enqueue_style
- how to execute some code after a post is published in WordPress [duplicate]
- Can i legally remove a credit from a free plugin on wordpress.org? [closed]
- CSS reset for plugin’s front end?
- Is there a counter for comments left?
- Delete Media not attached with Any posts
- remove ad to cart button and view more button if product price is empty
- Is there a way to remove a tooltip of a plugin via custom CSS? [closed]
- External wpdb connections in different plugins on single page
- getting notifications about updates only in the “core” page
- Api external with wordpress
- Plugin to reformat the post automatically after submitting
- Submit plugin for review
- How to add a WordPress Nonce for this form to avoid CSRF
- profile_update hook doesn’t works inside a class
- Correct Plugin File Path
- Function call in wordpress short code handler fails
- strange shortcode error: does shortcodes requires any dependency?
- Overriding current theme files via plugin
- How do I add an options page at the bottom of the list?
- Best way to salvage a very old WP site
- Development of plugins to add components like JqueryUI
- How to get a list of all the available plugins names
- All custom widgets are not showing in widget area at the same time