On this page
get_current_blog_id(): int
Retrieve the current site ID.
Return
int Site ID.
Source
File: wp-includes/load.php. View all references
function get_current_blog_id() {
global $blog_id;
return absint( $blog_id );
}
Related
Uses
| Uses | Description |
|---|---|
| absint() wp-includes/functions.php | Converts a value to non-negative integer. |
Used By
| Used By | Description |
|---|---|
| wp_initialize_site() wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| wp_uninitialize_site() wp-includes/ms-site.php | Runs the uninitialization routine for a given site. |
| wp_is_site_initialized() wp-includes/ms-site.php | Checks whether a site is initialized. |
| get_oembed_response_data_for_url() wp-includes/embed.php | Retrieves the oEmbed response data for a given URL. |
| WP_User::for_site() wp-includes/class-wp-user.php | Sets the site to operate on. Defaults to the current site. |
| WP_Roles::get_roles_data() wp-includes/class-wp-roles.php | Gets the available roles data. |
| WP_Roles::for_site() wp-includes/class-wp-roles.php | Sets the site to operate on. Defaults to the current site. |
| get_main_site_id() wp-includes/functions.php | Gets the main site ID. |
| clean_site_details_cache() wp-includes/ms-blogs.php | Cleans the site details cache for a site. |
| get_site() wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| has_custom_logo() wp-includes/general-template.php | Determines whether the site has a custom logo. |
| get_custom_logo() wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. |
| _wp_upload_dir() wp-includes/functions.php | A non-filtered, non-cached version of wp_upload_dir() that doesn’t check the path. |
| wp_get_users_with_no_role() wp-includes/user.php | Gets the user IDs of all users with no role on this site. |
| WP_User_Query::fill_query_vars() wp-includes/class-wp-user-query.php | Fills in missing query variables with default values. |
| WP_Customize_Nav_Menu_Setting::filter_nav_menu_options() wp-includes/customize/class-wp-customize-nav-menu-setting.php | Filters the nav_menu_options option to include this menu’s auto_add preference. |
| WP_Customize_Nav_Menu_Setting::value() wp-includes/customize/class-wp-customize-nav-menu-setting.php | Get the instance data for a given widget setting. |
| WP_Customize_Nav_Menu_Setting::preview() wp-includes/customize/class-wp-customize-nav-menu-setting.php | Handle previewing the setting. |
| WP_Customize_Nav_Menu_Setting::filter_wp_get_nav_menus() wp-includes/customize/class-wp-customize-nav-menu-setting.php | Filters the wp_get_nav_menus() result to ensure the inserted menu object is included, and the deleted one is removed. |
| WP_Customize_Nav_Menu_Setting::filter_wp_get_nav_menu_object() wp-includes/customize/class-wp-customize-nav-menu-setting.php | Filters the wp_get_nav_menu_object() result to supply the previewed menu object. |
| WP_Customize_Nav_Menu_Item_Setting::value() wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get the instance data for a given nav_menu_item setting. |
| WP_Customize_Nav_Menu_Item_Setting::preview() wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Handle previewing the setting. |
| get_site_icon_url() wp-includes/general-template.php | Returns the Site Icon URL. |
| WP_Customize_Setting::is_current_blog_previewed() wp-includes/class-wp-customize-setting.php | Return true if the current site is not the same as the previewed site. |
| _access_denied_splash() wp-admin/includes/ms.php | Displays an access denied message when a user tries to view a site’s dashboard they do not have access to. |
| wpmu_delete_blog() wp-admin/includes/ms.php | Delete a site. |
| wp_dashboard_quick_press() wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| wp_upgrade() wp-admin/includes/upgrade.php | Runs WordPress Upgrade functions. |
| wp_delete_user() wp-admin/includes/user.php | Remove user and optionally reassign posts and links to another user. |
| WP_Themes_List_Table::no_items() wp-admin/includes/class-wp-themes-list-table.php | |
| wp_ajax_autocomplete_user() wp-admin/includes/ajax-actions.php | Ajax handler for user autocomplete. |
| WP_User::get_role_caps() wp-includes/class-wp-user.php | Retrieves all of the capabilities of the user’s roles, and merges them with individual user capabilities. |
| WP_Object_Cache::__construct() wp-includes/class-wp-object-cache.php | Sets up object properties; PHP 5 style constructor. |
| get_users_of_blog() wp-includes/deprecated.php | Get users for the site. |
| WP_Theme::get_allowed_on_site() wp-includes/class-wp-theme.php | Returns array of stylesheet names of themes allowed on the site. |
| wp_start_object_cache() wp-includes/load.php | Start the WordPress object cache. |
| is_main_site() wp-includes/functions.php | Determines whether a site is the main site of the current network. |
| wp_upload_dir() wp-includes/functions.php | Returns an array containing the current upload directory’s path and URL. |
| get_dashboard_url() wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. |
| WP_Admin_Bar::initialize() wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| wp_admin_bar_site_menu() wp-includes/admin-bar.php | Adds the “Site Name” menu. |
| WP_Customize_Setting::preview() wp-includes/class-wp-customize-setting.php | Add filters to supply the setting’s value when accessed. |
| get_blogs_of_user() wp-includes/user.php | Gets the sites a user belongs to. |
| is_user_member_of_blog() wp-includes/user.php | Finds out whether a user is a member of a given blog. |
| count_users() wp-includes/user.php | Counts number of users who have each of the user roles. |
| wp_dropdown_users() wp-includes/user.php | Creates dropdown HTML content of users. |
| is_user_option_local() wp-includes/ms-deprecated.php | Check whether a usermeta key has to do with the current blog. |
| add_existing_user_to_blog() wp-includes/ms-functions.php | Adds a user to a blog based on details from maybe_add_existing_user_to_blog() . |
| update_blog_public() wp-includes/ms-functions.php | Updates this blog’s ‘public’ setting in the global blogs table. |
| get_active_blog_for_user() wp-includes/ms-functions.php | Gets one of a user’s active blogs. |
| switch_to_blog() wp-includes/ms-blogs.php | Switch the current blog. |
| restore_current_blog() wp-includes/ms-blogs.php | Restore the current blog, after calling switch_to_blog() . |
| refresh_blog_details() wp-includes/ms-blogs.php | Clear the blog details cache. |
| get_blog_option() wp-includes/ms-blogs.php | Retrieve option value for a given blog id based on name of option. |
| add_blog_option() wp-includes/ms-blogs.php | Add a new option for a given blog ID. |
| delete_blog_option() wp-includes/ms-blogs.php | Removes option by name for a given blog ID. Prevents removal of protected WordPress options. |
| update_blog_option() wp-includes/ms-blogs.php | Update an option for a particular blog. |
| wpmu_update_blogs_date() wp-includes/ms-blogs.php | Update the last_updated field for the current site. |
| get_blog_details() wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. |
| ms_upload_constants() wp-includes/ms-default-constants.php | Defines Multisite upload constants. |
| wp_just_in_time_script_localization() wp-includes/script-loader.php | Loads localized data on print rather than initialization. |
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_current_blog_id