plugin content on front-page only. Nowhere else

After turning on WP_DEBUG,

define('WP_DEBUG', true);

I was receiving the error: Conditional query tags do not work before the query is run. Before then, they always return false.

After googling that error, I found a solution that works:

add_action( 'template_redirect', 'check_for_frontpage' );

function check_for_frontpage() {
    if ( is_front_page() || is_home() ) {
        echo "<script>console.log( 'Debug Objects: is_front_page() && Home()' );</script>";
    } else {
        echo "<script>console.log( 'Debug Objects: ! is_front_page() && Home()' );</script>";
    }
}