Which is correct and why?

I was told she liked chocolate.
I was told that she liked chocolate.

I am not sure when the word that is required and when it is not necessary.
Hi Lara, welcome to the forums.

It adds no immediate value at all in that context; it doesn't change the meaning or emphasis!
They are both correct. "that" is optional in reported speech.
Students: Are you brave enough to let our tutors analyse your pronunciation?
Optional? What is "reported" speech? Is it truly an unnecessary word, i.e. adds no value at all, does not change the meaning, emphasis, etc.?
 hitchhiker's reply was promoted to an answer.
most romance languages require relative pronouns to be stated (who, that, which, where), but english does not. those of us who study hese languages tend to use relative pronouns in english more often than the average person. on rare occasion, they may clarify a sentence, but for the most part, may be eliminated without consequence.
Teachers: We supply a list of EFL job vacancies