Can't reload after "Delete"
-
Hi all
I’m developing a WordPress plugin for my own needs.
Maybe, I will try to release it later, but I need to fix some stuff first.First of all, I have created a “Delete” link, which will delete the URL with the ID thats provided. The link i working perfectly fine – I have another problem though. Whenever I delete something, I have to refresh the page to see the result (result = URL is gone) – this annoys me!
I have tried almost anything, but I really can’t make it work. No matter what I do, I get the message “Your URL was deleted successfully!” – but the link is still visible until I refresh the page 🙁
Here is how my link is built:
<a href="admin.php?page=comment-reminder&pageSet=true&action=del&id=<?php echo $print->id; ?>&_wpnonce=<?php echo $nonce; ?>">Delete</a>And I use an “isset” to handle the links info – it goes like this:
if(!isset($_GET['pageSet'])){ // Nothing happens if the link isn't clicked } else{ global $wpdb; $table_name = $wpdb->prefix . "my_new_plugin"; $blogid = mysql_real_escape_string($_GET['id']); if (!wp_verify_nonce($_GET['_wpnonce'],'my_new_plugin_nonce') ) { wp_die('Oops, your nonce didn\'t verify. So there.'); } else { $wpdb->query("DELETE FROM $table_name WHERE id = '$blogid'") or wp_die(mysql_error()); if($wpdb) { echo '<div class="updated"><p>URL successfully deleted!</p></div>'; } } }What do I have to do?
I’m really stuck here 🙁Once I figure this out, I’m sure I can make it work for the “Add new URL” fom also – same problem here … I can’t see the entered URL before I refresh the page. What am I doing wrong??
– Kucko
The topic ‘Can't reload after "Delete"’ is closed to new replies.