WP_Posts_List_Table::get_edit_link( string[] $args, string $label, string $class = '' )
Helper to create links to edit.php with params.
Parameters
- $args
-
(string[]) (Required) Associative array of URL parameters for the link.
- $label
-
(string) (Required) Link text.
- $class
-
(string) (Optional) Class attribute.
Default value: ''
Return
(string) The formatted link string.
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
);
} Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_posts_list_table/get_edit_link