WP_Posts_List_Table::get_edit_link() – Helper to create links to edit.php with params.

You appear to be a bot. Output may be restricted

Description

Helper to create links to edit.php with params.

Usage

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

Parameters

$args
( string[] ) required – Associative array of URL parameters for the link.
$link_text
( string ) required – Link text.
$css_class
( string ) optional – Optional. Class attribute. Default empty string.

Returns

string The formatted link string.

Source

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


Lines:

1 to 26 of 26
  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
    );
  }
 

 View on GitHub View on Trac