WP_List_Table::get_primary_column_name()protectedWP 4.3.0

Gets the name of the primary column.

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

Хуки из метода

Возвращает

Строку. The name of the primary column.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_primary_column_name();

Список изменений

С версии 4.3.0 Введена.

Код WP_List_Table::get_primary_column_name() WP 6.5.2

protected function get_primary_column_name() {
	$columns = get_column_headers( $this->screen );
	$default = $this->get_default_primary_column_name();

	/*
	 * If the primary column doesn't exist,
	 * fall back to the first non-checkbox column.
	 */
	if ( ! isset( $columns[ $default ] ) ) {
		$default = self::get_default_primary_column_name();
	}

	/**
	 * Filters the name of the primary column for the current list table.
	 *
	 * @since 4.3.0
	 *
	 * @param string $default Column name default for the specific list table, e.g. 'name'.
	 * @param string $context Screen ID for specific list table, e.g. 'plugins'.
	 */
	$column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );

	if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
		$column = $default;
	}

	return $column;
}