I have created new custom post type - deals in wordpress and it is redirect to edit.php(posts listing) after the publish new deal post. so I want to redirect it to deals list page (<a href="http://mydemo.com/demo/edit.php?post_type=deals" rel="nofollow">http://mydemo.com/demo/edit.php?post_type=deals</a>) so please help me.
I tried this code but it redirect all posts type to specified page.
I tried this code but it redirect all posts type to specified page.
Code:
add_filter( 'redirect_post_location', 'wpse_124132_redirect_post_location' );
/**
* Redirect to the edit.php on post save or publish.
*/
function wpse_124132_redirect_post_location( $location ) {
if ( isset( $_POST['save'] ) || isset( $_POST['publish'] ) )
return admin_url( "edit.php?post_type=deals" );
return $location;
}