When using wish, the tenses ‘go backwards’.
Wishes for the current time (now) use the past tense.
Wishes for the past use the past perfect tense.

Current Wishes

I may think ‘I want to be rich’ now, but have to use the past tense with wish.

Examples of Current Wishes (now)

I wish I don’t have homework – incorrect
I wish I didn’t have homework – correct

I wish she is my girlfriend – incorrect
I wish she was my girlfriend – correct

I wish I can do magic – incorrect
I wish I could do magic – correct

Past Wishes

Wishes in the past have to use the past perfect tense (had done/eaten/gone etc).

Examples of Past Wishes

I wish I studied harder when I was at school. – incorrect
I wish I had studied harder when I was at school. – correct

She wishes she didn’t kiss him. – incorrect
She wishes she hadn’t kissed him. – correct

He wishes he didn’t get drunk at the bar and acted stupidly in front of the staff. – incorrect
He wishes he hadn’t got drunk at the bar and acted stupidly in front of the staff. – correct