Skip to content

Commit e581cf5

Browse files
authored
Settings: Only initiate table that's needed (#1951)
1 parent 9823112 commit e581cf5

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

includes/wp-admin/class-admin.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,22 @@ public static function following_list_page() {
107107
}
108108
}
109109

110+
/**
111+
* Creates the followers and following list tables in ActivityPub settings.
112+
*/
113+
public static function add_settings_list_tables() {
114+
$tab = \sanitize_text_field( \wp_unslash( $_GET['tab'] ?? 'welcome' ) ); // phpcs:ignore WordPress.Security.NonceVerification
115+
116+
switch ( $tab ) {
117+
case 'followers':
118+
self::add_followers_list_table();
119+
break;
120+
case 'following':
121+
self::add_following_list_table();
122+
break;
123+
}
124+
}
125+
110126
/**
111127
* Creates the followers list table.
112128
*/

includes/wp-admin/class-menu.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public static function admin_menu() {
2828

2929
\add_action( 'load-' . $settings_page, array( Settings::class, 'add_settings_help_tab' ) );
3030
\add_action( 'load-users.php', array( Settings::class, 'add_users_help_tab' ) );
31-
\add_action( 'load-' . $settings_page, array( Admin::class, 'add_followers_list_table' ) );
32-
\add_action( 'load-' . $settings_page, array( Admin::class, 'add_following_list_table' ) );
31+
\add_action( 'load-' . $settings_page, array( Admin::class, 'add_settings_list_tables' ) );
3332
\add_action( 'load-' . $settings_page, array( Screen_Options::class, 'add_settings_list_options' ) );
3433

3534
// User has to be able to publish posts.

0 commit comments

Comments
 (0)