Redirect after deleting post
-
Hi there, your plugin is very useful to create custom post type…!!
I have created a custom post type called friend_request now what i want to do when user delete the post type friend_request, i want to redirect them to front page of site so that i created a plugin which simply redirect them to front-page of site which is working in localhost but its not working on live..!
Here is the plugin code
<?php
/*
* Plugin Name: Redirect on deleting post type friend_request
*/
add_action( ‘trashed_post’, ‘redirect_after_trashing’, 10, 1 );function redirect_after_trashing( $post_id ) {
global $post;// get the deleted post types
$deleted_post_type = $post->post_type;if($deleted_post_type == ‘friend_request’) {
wp_redirect( home_url() );
exit();
}
}Please help me on this case..!
Thanks!
The topic ‘Redirect after deleting post’ is closed to new replies.