WPSEO_Bulk_List_Table::sanitize_orderby()protectedYoast 1.0

Heavily restricts the possible columns by which a user can order the table in the bulk editor, thereby preventing a possible CSRF vulnerability.

Метод класса: WPSEO_Bulk_List_Table{}

Хуков нет.

Возвращает

Строку.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->sanitize_orderby( $orderby );
$orderby(строка) (обязательный)
The column by which we want to order.

Код WPSEO_Bulk_List_Table::sanitize_orderby() Yoast 22.3

protected function sanitize_orderby( $orderby ) {
	$valid_column_names = [
		'post_title',
		'post_type',
		'post_date',
	];

	if ( in_array( $orderby, $valid_column_names, true ) ) {
		return $orderby;
	}

	return 'post_title';
}