How can I make a custom edit page for my plugins admin UI page, if the requested page has a query argument of $_GET['action'] == 'edit'
?
My plugins entry url looks like
/admin.php?page=parser-top-level-handle
Than I have listed all my items per row in a table. On row hover appear "edit|delete"-links and other actions. If I'm then clicking on the edit
-link, I get the following URl:
/edit.php?page=parser-top-level-handle&action=edit&record=55
At this point, I'd like to redirect the user to the edit form.
The code what I'm trying to use to be redirected to custom edit Page
add_action( 'wp_loaded', array ( 'parserAdmin', 'init' ) );
class parserAdmin {
private $db;
private $add_page;
public static function init()
{
new self;
}
//the consructor for parser admin
function __construct(){
global $wpdb, $posts;
$this->db = $wpdb;
add_action('admin_menu', array($this , 'parser_add_pages') );
$this->get_targets();
//Here I inspect if action exits or not
if($_GET['action']){
switch ($_GET['action']){
case 'edit':
//than here should be a redirect to a custom page to edit the item passing the record query argument, do I need in this case hidden sup-page?!!!
break;
case 'delete':
var_dump('test');
$this->_delete_target($_GET['record'] , $_GET['post_id']);
break;
}
}
}