How to smoothly rotate an object on only two axes?

This is a function that is supposed to only reset the rotation of the player gameobject on the x & z axes.
I passed the value of the player’s current y-axis rotation because I thought it would maintain that rotation, but instead the y-axis also ends up moving towards 0.
I’m not sure if I’m doing something wrong with my Quaternion declaration or my usage of slerp.

void centerRotation(){
//rotate player character from current rotation in x & z axis To target rotation on x & z
Quaternion target = Quaternion.Euler(0,transform.rotation.y,0);
transform.rotation = Quaternion.Slerp(transform.rotation, target, rotSpeed*Time.deltaTime);

Use Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(target, Vector3.up), rotSpeed * Time.deltaTime);

lol, I figured it out.
I was using transform.rotation.y when I needed to be using transform.eulerAngles.y
rotation.y just returns a value between 0 and 1, eulerAngles gives you the actual rotation in degrees.