As of now the code works. Thank you very much once again. I will make sure to write a good review.
The code you provided crashed my website. Apparently there is an error in line 7.
Your code now works for some reason. Thank you for your help!
Thank you for such a quick response. Unfortunately the code seems to have not done anything. I tried adding it to the Astra Child theme’s functions and with the PHP plugin.