Sunday, 15 August 2010

php - Redirect after front end deleting post -


I created a post to delete a post on front end for a Wordpress site, this deletes the post properly, but then again the post Tries to load with which 404 is generated. Do I redirect it after a specific URL is deleted? This is my code:

  function wp_delete_post_link ($ link = 'delete it', $$ = '', $ after = '') {global $ post; $ Link = "& lt; a href = '" Wp_nonce_url (get_bloginfo (' url '). "/wp-admin/post.php?action=delete&post=". $ Post-> ID, Delete-post_ '. $ Post- & gt; ID). "'& Gt;" $ Link "& lt; / a & gt;" After $ $ per first $ link per dollar; Then  

; '); ? & Gt;

I think you're looking for the wp_redirect function Are there.

$ location = 'http://domainname.com/pagename/'; $ Position = '301'; Wp_redirect ($ location, $ position); Go out;

Just keep it after your successful delete code.


No comments:

Post a Comment