WP_Posts_List_Table::get_edit_link

Advertisement

Summery Summery

Helper to create links to edit.php with params.

Syntax Syntax

WP_Posts_List_Table::get_edit_link( string[] $args, string $label, string $class = '' )

Parameters Parameters

$args

(Required) Associative array of URL parameters for the link.

$label

(Required) Link text.

$class

(Optional) Class attribute.

Default value: ''

Return Return

(string) The formatted link string.

Source Source

File: wp-admin/includes/class-wp-posts-list-table.php

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

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

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

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

Advertisement

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Advertisement

Leave a Reply