WP_Roles::for_site()
Sets the site to operate on. Defaults to the current site.
Метод класса: WP_Roles{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
global $wp_roles; $wp_roles->for_site( $site_id );
- $site_id(int)
- Site ID to initialize roles for.
По умолчанию: current site
Заметки
- Global. wpdb. $wpdb WordPress database abstraction object.
Список изменений
С версии 4.9.0 | Введена. |
Код WP_Roles::for_site() WP Roles::for site WP 6.7.1
public function for_site( $site_id = null ) { global $wpdb; if ( ! empty( $site_id ) ) { $this->site_id = absint( $site_id ); } else { $this->site_id = get_current_blog_id(); } $this->role_key = $wpdb->get_blog_prefix( $this->site_id ) . 'user_roles'; if ( ! empty( $this->roles ) && ! $this->use_db ) { return; } $this->roles = $this->get_roles_data(); $this->init_roles(); }