WP_Links_List_Table::handle_row_actions() WordPress Method

The WP_Links_List_Table::handle_row_actions() method is responsible for taking the current links row action and performing the corresponding action.

WP_Links_List_Table::handle_row_actions( object $item, string $column_name, string $primary ) #

Generates and displays row action links.


Parameters

$item

(object)(Required)Link being acted upon.

$column_name

(string)(Required)Current column name.

$primary

(string)(Required)Primary column name.


Top ↑

Return

(string) Row actions output for links, or an empty string if the current column is not the primary column.


Top ↑

Source

File: wp-admin/includes/class-wp-links-list-table.php

	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.
		$link      = $item;
		$edit_link = get_edit_bookmark_link( $link );

		$actions           = array();
		$actions['edit']   = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
		$actions['delete'] = sprintf(
			'<a class="submitdelete" href="%s" onclick="return confirm( \'%s\' );">%s</a>',
			wp_nonce_url( "link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ),
			/* translators: %s: Link name. */
			esc_js( sprintf( __( "You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ),
			__( 'Delete' )
		);

		return $this->row_actions( $actions );
	}


Top ↑

Changelog

Changelog
VersionDescription
5.9.0Renamed $link to $item to match parent class for PHP 8 named parameter support.
4.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.