• Resolved maybenot

    (@maybenot)


    Hi,

    I’ve created a hook via Code Snippets. Also included an ads unit.

    add_action( 'generate_inside_container','insert_into_content' );  
    function insert_into_content() { ?> 
    <?php if ( is_single() ) : ?>
     <script async src="https://ads link"> my ads unit id
    </script>
    <?php endif; ?>
    <?php }

    Ads displays fine but it flags a “Your Site is Experiencing a Technical Issue” error.

    There probably is a basic error in it but I have no clue.

    Help please – thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Leo

    (@leohsiang)

    Hi there,

    Where are you seeing the error “Your Site is Experiencing a Technical Issue”?

    Thread Starter maybenot

    (@maybenot)

    Hi,

    Thanks for your quick response!

    It was an automated email: “Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.”

    And it directs me to the above snippet.

    Theme Author Tom

    (@edge22)

    I’m not seeing any errors in there, but it could be slightly cleaner:

    add_action( 'generate_inside_container', 'insert_into_content' );  
    function insert_into_content() {
        if ( is_single() ) : ?>
            <script async src="https://ads link">my ads unit id</script>
        <?php endif;
    }

    If you check your error_log file on the server, it should give you the exact error that’s happening. If you have the exact error feel free to share it and I’ll take a look ??

    Thread Starter maybenot

    (@maybenot)

    Thank you! Updated with a cleaner code.

    Got the same error after the update and my hosting company says the user.ini file was causing the issue so they disabled the file.

    Thank you for the awesome theme and support!

    Theme Author Tom

    (@edge22)

    Glad you got it sorted ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Generate Inside Container Hook and Ads’ is closed to new replies.