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

Helper to create links to edit.php with params.


Description Description


Parameters Parameters

$args

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

$label

(string) (Required) Link text.

$class

(string) (Optional) Class attribute.

Default value: ''


Top ↑

Return Return

(string) The formatted link string.


Top ↑

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
		);
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.