WordPress.org

Ready to get started?Download WordPress

Forums

alternative to wp_head (2 posts)

  1. fdomagro
    Member
    Posted 2 years ago #

    I'm writing a plugin to add metadata to posts and pages, so I need to change the header. In my specific case, I which to do it on-the-fly, so I'm not looking for the add_post_meta() function.

    I read add_action to wp_head would do it, but it depends on theme authors, and I didn't want my plugin to fail in some themes.

    Thanks.

  2. I didn't want my plugin to fail in some themes.

    I wouldn't worry about that too much, those themes that don't include wp_head() will not work with LOTS of plugins. ;)

    If you want, you could hook into

    add_action( 'loop_start' , 'your_function_here' );

    But loops run all the time and wouldn't get into the head portion. Depending on your code, that trick may not work.

Topic Closed

This topic has been closed to new replies.

About this Topic