Вопрос 1 — как прилепить ad_action(‘admin_notices’,’my_notice’) к table action…
1. Сохранить куда-нибудь информацию о том, что нужно вывести сообщение.
2. В функции, привязанной к admin_notices
, проверить необходимость вывода сообщения и затем вывести.
Вопрос 2 — Как очистить урл от get параметров после action
Примерно так можно попробовать:
$removable_query_args = wp_removable_query_args();
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( $removable_query_args, $current_url );
wp_redirect( $current_url );
exit;
Благодарю за ответ…
1 — делал так не работает. В итоге сделал так…
echo '<div id="message" class="updated fade"><p><strong>' . $message . '</strong></p></div>';
2 — через редирект не аис. В итоге сделал так…
public function handle_table_actions() {
$the_table_action = $this->current_action();
if(isset($_POST['id'])) $this->mу_action($_POST['id'], $the_table_action);
}
и так…
<form method="post">
<input type="hidden" name="page" value="<?php echo __CLASS__ ?>" />
<?php $this -> _Table -> display(); ?>
</form>
<form method="post">
<input type="hidden" name="page" value="<?php echo __CLASS__ ?>" />
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="id" value="" />
<input type="submit" value="delete_all" />
</form>