wordpress: how to enable the edit and delete action button in wp_list_table class of wordpress

Hi i am writing a plugin in which i have displayed various entries from database by extending wordpress wp_list_table class.
To display some action links in every single row i have used this function in such following way.

function column_name($item) {
    $actions = array(
        'edit' => sprintf('<a href="?page=%s&action=%s& hotel=%s">Edit</a>',$_REQUEST['page'],'edit',$item['id']),
        'delete' => sprintf('<a href="?page=%s&action=%s&hotel=%s">Delete</a>',$_REQUEST['page'],'delete',$item['id']),
    );
    return sprintf('%1$s %2$s', $item['Name'], $this->row_actions($actions) );
}

but from admin page when i click on those links nothing happen only the url changes i searched every ware and most of the examples are using static data in the form of array so what i want to say is how i can make it active by $_GET[] method or is there any other way to do it ?

Related posts

Leave a Reply

1 comment

  1. Back in your settings page, you should add an if statement for the $GET value. (i.e. the callback from your add(sub)menu_page call.

    e.g.

    if( isset( $_GET['edit-hotel'] ) ) :
      // Show my edit hotel form
    else :
      // Show my WP_List_Table
    endif;
    

    You can of course show the list table above your edit form as well if appropriate – this is just an example.

    Be aware that the WP_List_table class is marked @access private so shouldn’t really be used as part of the API. See this comment from WordPress core developer Andrew Nacin.