Former Glee star Naya Rivera has revealed she underwent an abortion while filming the hit series.

The 29-year-old, who is now a mother to 11-month-old son Josey Hollis, explained all to People magazine about her difficult decision.

She discovered she had fallen pregnant with actor Ryan Dorsey’s child shortly after they split back in 2010: Ryan is now her husband after they married in 2014.

Ryan Dorsey and Naya Rivera
Ryan Dorsey and Naya Rivera in 2015 (Jordan Strauss/Invision/AP)

Naya had originally split from him in order to focus on her career, which was taking off thanks to her role as Santana Lopez in the hit musical-comedy series.

And, instead of telling him of the pregnancy, she chose to terminate it and focus on her career. She underwent the abortion during a day off work filming Glee.

Her revelations about the abortion come as she’s set to release a memoir entitled Sorry Not Sorry: Dreams, Mistakes And Growing Up.

Naya Rivera as Santana Lopez
Naya Rivera as Santana Lopez in Glee (Fox)

She said: “It was very scary to open up about everything.

“It’s not something a lot of people talk about, but I think they should. I know some people might read it and say, ‘What the Hell?’ But I hope someone out there gets something out of it.”

The book also sees her detail her battle with an eating disorder, and she hopes it will inspire others to address their own issues.

Naya has also expressed her wishes that her baby son reads it some day in order to help him understand women more.

She said: “I hope Josey will read it one day. I hope it gives him a better perspective on the issues women face.”

Following her admission, Naya took to Twitter to repost messages from fans who had thanked her for coming out and saying it.

She also explained that she did what she did because the “media will always distort” things and that she had “good intentions” in sharing all.

Naya reunited with Ryan in 2014, and the two married months later in Mexico. They welcomed their son Josey in September 2015.