# wp_register()

URL: https://chugunov.pro/api-wordpress/functions/wp_register/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 1.5.0.

## Сигнатура

```php
wp_register( string $before = '<li>', string $after = '</li>', bool $display = true ): void|string
```

## Описание

Отображает ссылку, позволяющую пользователю перейти на страницу регистрации, если он не вошёл в систему и регистрация включена, или в консоль, если вход выполнен.

## Параметры

- `$before` `string` — необязательный, по умолчанию `'<li>'`. Текст для вывода перед ссылкой. Значение по умолчанию
  - .
- `$after` `string` — необязательный, по умолчанию `'</li>'`. Текст для вывода после ссылки. Значение по умолчанию .
- `$display` `bool` — необязательный, по умолчанию `true`. По умолчанию ссылка выводится, а не возвращается.

## Возвращаемое значение

`void|string` — $display $display

## Исходный код

Файл: `wp-includes/general-template.php:705`

```php
function wp_register( $before = '<li>', $after = '</li>', $display = true ) {
	if ( ! is_user_logged_in() ) {
		if ( get_option( 'users_can_register' ) ) {
			$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __( 'Register' ) . '</a>' . $after;
		} else {
			$link = '';
		}
	} elseif ( current_user_can( 'read' ) ) {
		$link = $before . '<a href="' . admin_url() . '">' . __( 'Site Admin' ) . '</a>' . $after;
	} else {
		$link = '';
	}

	/**
	 * Filters the HTML link to the Registration or Admin page.
	 *
	 * Users are sent to the admin page if logged-in, or the registration page
	 * if enabled and logged-out.
	 *
	 * @since 1.5.0
	 *
	 * @param string $link The HTML code for the link to the Registration or Admin page.
	 */
	$link = apply_filters( 'register', $link );

	if ( $display ) {
		echo $link;
	} else {
		return $link;
	}
}
```

## История изменений

- 1.5.0 — Introduced.

## Связанные

Использует: [`wp_registration_url`](https://chugunov.pro/api-wordpress/functions/wp_registration_url/), [`current_user_can`](https://chugunov.pro/api-wordpress/functions/current_user_can/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`esc_url`](https://chugunov.pro/api-wordpress/functions/esc_url/), [`is_user_logged_in`](https://chugunov.pro/api-wordpress/functions/is_user_logged_in/), [`admin_url`](https://chugunov.pro/api-wordpress/functions/admin_url/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_option`](https://chugunov.pro/api-wordpress/functions/get_option/).
Используется в: `WP_Widget_Meta::widget`.

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/wp_register/
