Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Kristjan-Reinsberg/add79724408e743c9e3351493fd4a897 to your computer and use it in GitHub Desktop.

Select an option

Save Kristjan-Reinsberg/add79724408e743c9e3351493fd4a897 to your computer and use it in GitHub Desktop.
WP PLUGIN HOW TO ADD EDIT PAGE (as request parameter for X plugin page)
# NB! DO NOT USE add_page or add_sub_page for that
# EXAMPLE: just use plugin main page and add request parameters
global $wp;
$query = add_query_arg( admin_url() , $wp->query_vars );
$edit_query = add_query_arg( array(
'page' => "plugin-page-home",
'car_id' => $car->id,
'work_id' => $work->id
), $query );
?>
<a class="btn btn-sm btn-warning" href="<?php echo $edit_query; ?>">Edit</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment