Hello, I have recently setup a wordpress site and I am getting an error on the front end. }catch (ex){} https://quirke.one Can someone help me hide this error from the front end. Thanks.
The error message you provided is a generic JavaScript catch block, which doesn't give much information about the actual error that is occurring on your website. To troubleshoot the error and hide it from the front end, you can try the following steps: Check the browser console: Open your website in a web browser and check the browser console for any error messages that are displayed. The console may provide more specific information about the error that is causing the catch block to be triggered. Disable plugins: Try disabling all of your WordPress plugins and see if the error message goes away. If it does, then you can re-enable each plugin one by one to identify the plugin that is causing the error. Check your theme: If the error message is still displayed after disabling all of your plugins, try switching to a default WordPress theme, such as Twenty Twenty-One. If the error goes away, then your theme may be the cause of the error. Update WordPress and plugins: Make sure that you are running the latest version of WordPress and all of your plugins. Outdated software can cause compatibility issues and errors. Contact your web hosting provider: If you are still unable to identify and resolve the error, contact your web hosting provider for assistance. They may be able to identify any server-side issues that are causing the error message to be displayed. By following these steps, you should be able to identify and resolve the error that is causing the catch block to be displayed on your website. Once the error is resolved, the catch block should no longer be displayed on the front end.
To me that looks like you've got your brackets wrong and the text is being treated as normal html. I couldn't see it on your site. Can you post a screen shot please?
ok, thanks, so your page is displaying code that should be hidden. I'm guessing it's this: <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-8RRET2MJ9Q'); </script> <meta name="p:domain_verify" content="3bc8c3731d24ba8f0734d99f31f7a50e"/> }catch (ex){}</script> <style type="text/css" id="wp-custom-css"> .single-product span.sku_wrapper { display: none !important; } </style> <style type="text/css" data-type="vc_custom-css">.image_max_width .vc_figure { max-width: 60%; }</style><noscript><style> .wpb_animate_when_almost_visible { opacity: 1; }</style></noscript></head> Code (markup): See how after the meta tag there's suddenly javascript? Even though it's in the head it's obviously junk and somehow got pasted in.
Thanks for identifying the error. I deleted all the custom headers using theme options, but still the error is seen I guess I have to edit the theme files?
The hosting company isn't going to care. It's a simple template fix. If the theme has support that might be the way to go.