Unclosed ‘{‘ on line 1

[ad_1]

Hi @iacopoincerpi,

Thank you for sharing the screenshot, I can’t replicate this issue on my end with the PHP code you shared. Have you changed the server PHP version recently by any chance?

Is the end of the snippet correctly formatted to close the opening {?

Do you have other PHP snippets active that might be interfering here somehow?

Thread Starter
Iacopo

(@iacopoincerpi)

Already tried to close, same result. In other website the same code work (same version of php and same codesnippet version)

Hi @iacopoincerpi,

That’s not going to work and I’m not sure how it worked before but you need to close the add_action and the function, basically you need to add the line highlighted in the screenshot at the end: https://a.supportally.com/i/HXOQGI

Thread Starter
Iacopo

(@iacopoincerpi)

Now working on that site.

But in other site still work activated like this…

@iacopoincerpi – I’m not sure how that works but I’d recommend updating the code for both versions. Alternatively, you can simply remove all the PHP part and use an HTML snippet with the auto-insert location set to Site Wide Header and it will work the same but with no risk of a PHP error from the snippet.

Thread Starter
Iacopo

(@iacopoincerpi)

Thanks for the help, appreciated

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer