WP_Posts_List_Table::get_edit_link()protectedWP 4.4.0

Creates a link to edit.php with params.

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

Хуков нет.

Возвращает

Строку. The formatted link string.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_edit_link( $args, $link_text, $css_class );
$args(string[]) (обязательный)
Associative array of URL parameters for the link.
$link_text(строка) (обязательный)
Link text.
$css_class(строка)
Class attribute.
По умолчанию: empty string

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

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

Код WP_Posts_List_Table::get_edit_link() WP 6.5.2

protected function get_edit_link( $args, $link_text, $css_class = '' ) {
	$url = add_query_arg( $args, 'edit.php' );

	$class_html   = '';
	$aria_current = '';

	if ( ! empty( $css_class ) ) {
		$class_html = sprintf(
			' class="%s"',
			esc_attr( $css_class )
		);

		if ( 'current' === $css_class ) {
			$aria_current = ' aria-current="page"';
		}
	}

	return sprintf(
		'<a href="%s"%s%s>%s</a>',
		esc_url( $url ),
		$class_html,
		$aria_current,
		$link_text
	);
}