WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a plugin that generates a meta description or title as two of its features. However I run into the problem of other SEO plugins possibly being installed, and ending up with two meta descriptions or duplicate titles.

Ideally, I'd like to detect what is already in the <head> section and if a meta description is present, re-write it with the output from my plugin. If no meta description is present, then I simply add one (that's the easy part). Same situation for titles.

Trouble is I can't seem to find any way to get the contents of <head>, as one can with the_content in a filter or action hook. It's not an option to edit the theme as this must work regardless of the installed theme. I need a way to accomplish this using a hook or some other method from within my plugin itself.

Suggestions? Thanks!

share|improve this question

Use, wp_head http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head

Ref example: Wordpress wp_head() crap

share|improve this answer
To expound on that a bit: you can find out what functions other Plugins hook into wp_head, and then make your own code conditional on if ( ! function_exists( 'other_plugin_wp_head_hook_function' ) ). – Chip Bennett Jul 17 '11 at 19:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.