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
- A better way to override plugin’s JS files?
- Output before and after the loop
- How to make sense of the active_plugins option_value to enable and disable certain plugins from the database?
- Loading posts associated only to the logged in user on recent posts page
- Disabling Comment Notifications for Post Author
- Disable author pages for specific users
- Can I enable/disable/hide plugins on a per-site basis in multisite?
- How do you import members from another system to WordPress and update passwords so they’ll work?
- Get info (url) from already enqueued styles
- WordPress import does not fetch images, but just links them
- Show the “ratingValue” and “ratingCount” values of KK Star Ratings Plugin
- bulk post_content update
- Plugin throws up 404 on front-end when when enqueuing style with filetime
- Woocommerce cart is a non-object inside `admin_post` action [closed]
- What are WordPress installation percentages by version?
- Peer Review Plugin for Posts? [closed]
- Show a confirmation message on plugin deactivation
- How extend shortcode default values for a plugin?
- WooCommerce – Is is possible to replace downloadable file and allow existing customer to get it?
- How to debug register_setting callback function
- WordPress redirect all 404 pages to the Homepage
- I’m trying to update user meta but is always 1, What I doing wrong? [closed]
- Are these wp-content permissions safe?
- Disable all scripts and styles from NextGEN Gallery? [closed]
- Detect permalinks when passing querystring in REST API requests
- Getting value from Advanced Custom Fields [closed]
- Layout Plugin Admin Pages: Use BootStrap? [closed]
- Using WP Category Lists Plugin to Dynamically Display Category (PHP)
- Adding sections in the ‘Pages’ post type
- AJAX in plugin wp_send_json() sending html
- How do I network enable a plugin for a multisite install via the database?
- Updated 4.3 Getting Error: Warning: call_user_func_array() expects parameter 1 to
- Ordering taxonomies by rank
- Embed plugin into Custom Page Template
- My homemade plugin is trying to update to someone else’s plugin
- Retrieving links and names of images from a NextGEN gallery [closed]
- Plugin development: what to prefix?
- Submit Form data to another page via Ajax (WordPress Way)
- Getting taxonomy images to display on single-post with their terms
- Where to populate custom terms in custom taxonomy in plugin?
- Is changing post from category in a large blog a good practice?
- Contact Form 7 – Show image on successful send? [closed]
- Send email to multiple addresses on Contact Form 7, but exclude personal details on all but one
- Display site language setting in source code
- simple-job-board Plugin throws an error on live server [closed]
- Make 2 different WooCommerce checkout pages?
- Plugin code will not work properly inside a class [closed]
- How to install a translation for a WP plugin?
- Plugin for TinyMCE to create reference to other posts
- Why may one avoid Jetpack plugin? [closed]
- XML Sitemap Generator and 404 problem
- How do I work with the SlideDeck plug-in?
- Why is adoptStyles-css stylesheet link added to every page?
- Stopping WordPress’ WYSIWYG Editor from Converting “didn’t” into “didn””””’t”?
- User loggedin as Subscriber form not sending
- wc_get_template_part doesnt display the content [duplicate]
- Thumbnail image doesn’t show up in Shortcode output
- how to split and upload a theme on wordpress?
- Fatal error: require_once(): Failed opening required
- shortcodes not working [dt_carousel & [dt_fancy_image
- Load google font script based on optgroup label selected
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- Unload a woff file from WordPress
- Crazy redirect happening with no redirects set up
- How To Use htaccess to Rewrite Link Structure for a Page that is Generated Programatcially
- Programmatically generate new pages for a site based on page template and content elements accessed via DB
- Custom Icon assigned to menu items not working for multi-site networks
- how to add navigation icons in specific template?
- Shows warning when enable “wp_gallery_custom_links” plugin with Themify Builder
- WordPress environment not loading properly
- WP_Query Date Filtering Inclusive Being Ignored
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- wordpress plugin | short code issue
- WordPress site keeps getting flagged as malware [closed]
- How can I display custom snippet codes in the front end of my WordPress site
- Neither update_option nor delete_option fires in deactivation hook
- How to export post tags from wordpress
- Plugin_Upgrader not working if function is called from remote server
- Show WooCommerce products based on query parameters on redirect
- how to code activate/deactive button of custom plugin within backend?
- Error 400 Invalid “products[1].productId” Kinguin [closed]
- USPS shipping costs are being doubled when using the USPS shipping method plugin [closed]
- How to make a drop-down list so you can press and change display like on this website by using wordpress or CSS
- How to customize WP_Error (REST JWT authentication plugin) [closed]