• Resolved mickna

    (@mickna)


    This is strange—what’s wrong with me? I write in a snippet:

    echo “hello”;

    but no output. If I write:

    add_filter( ‘show_admin_bar’, ‘__return_false’ );

    echo “hello”;

    The admin bar is hidden on frontend, but “hello” is missing. Why is that? Thank you, mickna

    Theme: a fresh Twenty Twenty-Five

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Hi @mickna,

    Snippets are loaded at the same time as plugins, before the page itself loads, so they shouldn’t really echo or output anything, or it has a high chance of breaking the page.

    If you want to generate output, I recommend using an action hook to do so, or to create a ‘Content’ snippet that you can then include in a post or page with a shortcode.

    Please let me know if you have a more specific example and I can help you out!

    Thread Starter mickna

    (@mickna)

    Hello Shea,

    Thank you. This makes sens 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘echo with no output?’ is closed to new replies.