wp_ajax_hidden_columns()

In this article

Handles hidden columns via AJAX.

Source

function wp_ajax_hidden_columns() {
	check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
	$page = isset( $_POST['page'] ) ? $_POST['page'] : '';

	if ( sanitize_key( $page ) !== $page ) {
		wp_die( 0 );
	}

	$user = wp_get_current_user();
	if ( ! $user ) {
		wp_die( -1 );
	}

	$hidden = ! empty( $_POST['hidden'] ) ? explode( ',', $_POST['hidden'] ) : array();
	update_user_meta( $user->ID, "manage{$page}columnshidden", $hidden );

	wp_die( 1 );
}

Changelog

VersionDescription
3.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.