The install_global_terms() WordPress PHP function installs global terms used across the entire WordPress multisite network.
Usage
install_global_terms();
Parameters
- None
More information
See WordPress Developer Resources: install_global_terms()
Examples
Installing global terms during multisite setup
If you’re setting up a multisite network, use install_global_terms() to install global terms.
// Install global terms during multisite setup
function setup_multisite_network() {
// Your multisite setup logic here
// Install global terms
install_global_terms();
}
Installing global terms after creating a new site
When creating a new site in a multisite network, use install_global_terms() to ensure the new site has the global terms.
// Install global terms after creating a new site
function new_site_setup($new_site_id) {
// Your new site setup logic here
// Install global terms
install_global_terms();
}
Installing global terms when switching to multisite
If you’re switching an existing WordPress installation to a multisite network, use install_global_terms() to install global terms.
// Install global terms when switching to multisite
function switch_to_multisite() {
// Your logic to switch to multisite
// Install global terms
install_global_terms();
}
Installing global terms on a plugin activation
When creating a plugin that requires global terms, use install_global_terms() during plugin activation.
// Install global terms on plugin activation
function my_plugin_activate() {
// Your plugin activation logic here
// Install global terms
install_global_terms();
}
register_activation_hook(__FILE__, 'my_plugin_activate');
Installing global terms on a theme activation
If your theme requires global terms, use install_global_terms() during theme activation.
// Install global terms on theme activation
function my_theme_activate() {
// Your theme activation logic here
// Install global terms
install_global_terms();
}
add_action('after_switch_theme', 'my_theme_activate');