updating posts function to redirect back to posts page