返回介绍

_get_list_table()

发布于 2017-09-11 13:23:56 字数 4121 浏览 1055 评论 0 收藏 0

Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_get_list_table( string $class,  array $args = array() )

Fetch an instance of a WP_List_Table class.


description


参数

$class

(string) (Required) The type of the list table, which is the class name.

$args

(array) (Optional) Arguments to pass to the class. Accepts 'screen'.

Default value: array()


返回值

(object|bool) Object on success, false if the class does not exist.


源代码

File: wp-admin/includes/list-table.php

function _get_list_table( $class, $args = array() ) {
	$core_classes = array(
		//Site Admin
		'WP_Posts_List_Table' => 'posts',
		'WP_Media_List_Table' => 'media',
		'WP_Terms_List_Table' => 'terms',
		'WP_Users_List_Table' => 'users',
		'WP_Comments_List_Table' => 'comments',
		'WP_Post_Comments_List_Table' => array( 'comments', 'post-comments' ),
		'WP_Links_List_Table' => 'links',
		'WP_Plugin_Install_List_Table' => 'plugin-install',
		'WP_Themes_List_Table' => 'themes',
		'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ),
		'WP_Plugins_List_Table' => 'plugins',
		// Network Admin
		'WP_MS_Sites_List_Table' => 'ms-sites',
		'WP_MS_Users_List_Table' => 'ms-users',
		'WP_MS_Themes_List_Table' => 'ms-themes',
	);

	if ( isset( $core_classes[ $class ] ) ) {
		foreach ( (array) $core_classes[ $class ] as $required )
			require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php' );

		if ( isset( $args['screen'] ) )
			$args['screen'] = convert_to_screen( $args['screen'] );
		elseif ( isset( $GLOBALS['hook_suffix'] ) )
			$args['screen'] = get_current_screen();
		else
			$args['screen'] = null;

		return new $class( $args );
	}

	return false;
}

更新日志

Versiondescription
3.1.0Introduced.

相关函数

Uses

  • wp-admin/includes/screen.php: get_current_screen()
  • wp-admin/includes/template.php: convert_to_screen()

Used By

  • wp-admin/includes/ajax-actions.php: wp_ajax_search_install_plugins()
  • wp-admin/includes/ajax-actions.php: wp_ajax_search_plugins()
  • wp-admin/includes/theme-install.php: display_theme()
  • wp-admin/includes/theme-install.php: display_themes()
  • wp-admin/includes/theme-install.php: install_theme_information()
  • wp-admin/includes/update.php: wp_plugin_update_row()
  • wp-admin/includes/update.php: wp_theme_update_row()
  • wp-admin/includes/dashboard.php: wp_dashboard_recent_comments()
  • wp-admin/includes/template.php: wp_comment_reply()
  • wp-admin/includes/ajax-actions.php: wp_ajax_add_user()
  • wp-admin/includes/ajax-actions.php: wp_ajax_inline_save()
  • wp-admin/includes/ajax-actions.php: wp_ajax_inline_save_tax()
  • wp-admin/includes/ajax-actions.php: wp_ajax_add_tag()
  • wp-admin/includes/ajax-actions.php: wp_ajax_get_comments()
  • wp-admin/includes/ajax-actions.php: wp_ajax_replyto_comment()
  • wp-admin/includes/ajax-actions.php: wp_ajax_edit_comment()
  • wp-admin/includes/ajax-actions.php: wp_ajax_fetch_list()
  • wp-admin/includes/meta-boxes.php: post_comment_meta_box()
  • Show 13 more used by Hide more used by

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文