Posted on August 8, 2013 , Last Modified on: August 8, 2013
BuddyBlog Redirect to single post on new post creation or post update
//redirect to single post on save/update
//in future, I will add two different options for new post/update post
add_action( 'bsfep_post_saved', 'buddyblog_redirect_on_post' );
function buddyblog_redirect_on_post( $post_id ){
$post = get_post( $post_id );
$post_type = get_post_type( $post );
$post_type_details = get_post_type_object( $post_type );
$message = sprintf( __( '%s Saved as %s successfully.', 'bsfep' ), $post_type_details->labels->singular_name, get_post_status( $post_id ) );
bp_core_add_message( $message );
bp_core_redirect( get_permalink( $post_id ) );
}
@buddyblog #buddypress #buddyblog