wppaste
WordPress

WP_MS_Sites_List_Table::handle_row_actions( array $item, string $column_name, string $primary ): string

Since
4.3.0, 5.9.0
Source
wp-admin/includes/class-wp-ms-sites-list-table.php:715
Generates and displays row action links.

Parameters

$itemarray
Site being acted upon.
$column_namestring
Current column name.
$primarystring
Primary column name.

Return

string
Row actions output for sites in Multisite, or an empty string if the current column is not the primary column.

Hooks fired · 1

One hook fires while WP_MS_Sites_List_Table::handle_row_actions() runs, in this order:

  1. apply_filters( manage_sites_action_links )filterline 859 (+144 into the body)

    Filters the action links displayed for each site in the Sites list table.

Uses · 12

  • untrailingslashit()Removes trailing forward slashes and backslashes if they exist.
  • esc_url()Checks and cleans a URL.
  • network_admin_url()Retrieves the URL to the admin area for the network.
  • __()Retrieves the translation of $text.
  • get_admin_url()Retrieves the URL to the admin area for a given site.
  • is_main_site()Determines whether a site is the main site of the current network.
  • wp_nonce_url()Retrieves URL with nonce added to URL query.
  • _x()Retrieves translated string with gettext context.
  • current_user_can()Returns whether the current user has the specified capability.
  • get_home_url()Retrieves the URL for a given site where the front end is accessible.
  • apply_filters()Calls the callback functions that have been added to a filter hook.
  • WP_MS_Sites_List_Table::row_actions()

Source

	protected function handle_row_actions( $item, $column_name, $primary ) {		if ( $primary !== $column_name ) {			return '';		} 		// Restores the more descriptive, specific name for use within this method.		$blog = $item; 		$blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); 		// Preordered.		$actions = array(			'edit'       => '',			'backend'    => '',			'activate'   => '',			'deactivate' => '',			'archive'    => '',			'unarchive'  => '',			'spam'       => '',			'unspam'     => '',			'delete'     => '',			'visit'      => '',		); 		$actions['edit'] = sprintf(			'<a href="%1$s">%2$s</a>',			esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ),			__( 'Edit' )		); 		$actions['backend'] = sprintf(			'<a href="%1$s" class="edit">%2$s</a>',			esc_url( get_admin_url( $blog['blog_id'] ) ),			__( 'Dashboard' )		); 		if ( ! is_main_site( $blog['blog_id'] ) ) {			if ( '1' === $blog['deleted'] ) {				$actions['activate'] = sprintf(					'<a href="%1$s">%2$s</a>',					esc_url(						wp_nonce_url(							network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] ),							'activateblog_' . $blog['blog_id']						)					),					_x( 'Activate', 'site' )				);			} else {				$actions['deactivate'] = sprintf(					'<a href="%1$s">%2$s</a>',					esc_url(						wp_nonce_url(							network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] ),							'deactivateblog_' . $blog['blog_id']						)					),					__( 'Deactivate' )				);			} 			if ( '1' === $blog['archived'] ) {				$actions['unarchive'] = sprintf(					'<a href="%1$s">%2$s</a>',					esc_url(						wp_nonce_url(							network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] ),							'unarchiveblog_' . $blog['blog_id']						)					),					__( 'Unarchive' )				);			} else {				$actions['archive'] = sprintf(					'<a href="%1$s">%2$s</a>',					esc_url(						wp_nonce_url(							network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] ),							'archiveblog_' . $blog['blog_id']						)

History

Introduced in 4.3.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

5.9.0
Renamed $blog to $item to match parent class for PHP 8 named parameter support.from the docblock
4.3.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-admin/includes/class-wp-ms-sites-list-table.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.