WordPress.org

Ready to get started?Download WordPress

Forums

another arcane query about plugin hooks (9 posts)

  1. notthatugly
    Member
    Posted 9 years ago #

    In the default and classic themes, the wp_head hook is called with <?php wp_head(); ?>. So, by analogy, wp_footer should be <?php wp_footer(); ?>, but when I do this I get an 'undefined function' parse error. Turns out that we have to use <?php do_action('wp_footer'); ?> instead. No problem with that, but why the different formats? These unexplained anomalies just make things harder for those of us who are trying to do things properly.

    I wonder how many of the current competition themes (other than those based on Kubrick) even bother with plugin hooks. Is it honestly worth my while to keep hammering away at this?

  2. Joshua Sigar
    Member
    Posted 9 years ago #

    Do you know what wp_head() do? It calls do_action( 'wp_header' ).
    I guess someone forgot to do the same thing with footer hook.

  3. notthatugly
    Member
    Posted 9 years ago #

    Well, that was illuminating. Thanks. Should I file it as a bug or take it that no-one cares?

  4. Kafkaesqui

    Posted 9 years ago #

    "Should I file it as a bug or take it that no-one cares?"

    Filing a bug would show that someone cares, right?

  5. notthatugly
    Member
    Posted 9 years ago #

    Yes, but if the developers can't be bothered to make the hooks consistent, and other theme-makers can't be bothered to insert them, and plugin-makers can't be bothered to use the hooks in the first place, that suggests I'd be the only person on the planet who did care. I haven't yet slid far enough into geekery to be 100% comfortable with that level of sadness. Hell, I'm embarrassed that I cared enough to ask this question in the first place.

  6. Ming
    Member
    Posted 9 years ago #

    pobody's nerfect

  7. Kafkaesqui

    Posted 9 years ago #

    All I can say is, if users don't ask, nicely but firmly and continuously, for developers, plugin writers and theme designers to stay consistent and use the functionality provided, then why should they bother?

  8. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    File a bug. I personally don't like having do_action calls directly in templates and would prefer using wp_footer().

  9. angsuman
    Member
    Posted 9 years ago #

    Actually plugin authors love hooks, more the better. However hooks do come with slight penalty in performance. It is painful to ask someone to change code to make certain plugins work.

    I think you should file the bug.
    I have sometimes seen people in this forum get very emotional when you criticize their pet ideas/projects :)
    Nevertheless filing a bug is the right thing to do.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.