WP_Posts_List_Table::get_edit_link( string[] $args, string $link_text, string $css_class =  ): string

In this article

Creates a link to edit.php with params.

Parameters

$argsstring[]required
Associative array of URL parameters for the link.
$link_textstringrequired
Link text.
$css_classstringoptional
Class attribute.

Default:''

Return

string The formatted link string.

Source

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

Changelog

VersionDescription
4.4.0Introduced.

User Contributed Notes

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