If this is in the admin, use the action
parameter:
<a href="https://wordpress.stackexchange.com/questions/159391/<?php echo esc_url( admin_url("?action=delete_ticket&ticket_id=$ticket->ID" ) ?>">Delete item</a>
…and then hook appropriately:
function wpse_159391_delete_ticket() {
if ( isset( $_GET['ticket_id'] ) ) {
// delete it!
}
}
add_action( 'admin_action_delete_ticket', 'wpse_159391_delete_ticket' );
For the front-end, you can just append your parameters to the current url and listen out for them on template_redirect
:
function wpse_159391_delete_ticket() {
if ( isset( $_GET['delete_ticket'] ) ) {
$ticket_id = $_GET['delete_ticket'];
// delete it!
}
}
add_action( 'template_redirect', 'wpse_159391_delete_ticket' );
To redirect after processing:
// Get the URL of the current page/post
if ( is_singular() )
$url = get_permalink( get_queried_object_id() );
// Get custom URL
$url = home_url( 'my/url/path?arguments' );
// Get current URI with removed arguments
$url = remove_query_arg( 'delete_ticket' );
// Get current URI with added arguments
$url = add_query_arg( 'success', 'true' );
wp_redirect( $url );
exit;