WordPress at Your Fingertips
function is not described

WP_Themes_List_Table::_js_vars() public WP 3.4.0

Send required variables to JavaScript land

{} It's a method of the class: WP_Themes_List_Table{}

No Hooks.

Return

null. Nothing.

Usage

$WP_Themes_List_Table = new WP_Themes_List_Table();
$WP_Themes_List_Table->_js_vars( $extra_args );
$extra_args(array)
-
Default: array()

Changelog

Since 3.4.0 Introduced.

Code of WP_Themes_List_Table::_js_vars() WP 5.8.2

public function _js_vars( $extra_args = array() ) {
	$search_string = isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';

	$args = array(
		'search'      => $search_string,
		'features'    => $this->features,
		'paged'       => $this->get_pagenum(),
		'total_pages' => ! empty( $this->_pagination_args['total_pages'] ) ? $this->_pagination_args['total_pages'] : 1,
	);

	if ( is_array( $extra_args ) ) {
		$args = array_merge( $args, $extra_args );
	}

	printf( "<script type='text/javascript'>var theme_list_args = %s;</script>\n", wp_json_encode( $args ) );
	parent::_js_vars();
}