WordPress action hook

wpseo_head

Fired by 8 WordPress plugins, running on 10M+ sites between them.

How to use wpseo_head

It's an action: your callback runs at that point. Nothing needs to be returned. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_action( 'wpseo_head', function() {
	// Your code runs here.
}, 10, 1 );

Argument names come from Yoast SEO's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

8 plugins that fire wpseo_head

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Yoast SEO icon Yoast SEO10+ million installs do_action( 'wpseo_head' ) src/integrations/front-end-integration.php:457
  2. FunnelKit icon FunnelKit30,000+ installs do_action( 'wpseo_head' ) modules/checkouts/compatibilities/others/class-seo-wp.php:33
  3. AMP WP icon AMP WP600+ installs do_action( 'wpseo_head' ) includes/class-amp-wp-plugin-compatibility.php:746
  4. WP Theme Optimizer icon WP Theme Optimizer400+ installs do_action( 'wpseo_head' ) public/class-wpto-public.php:201
  5. Genoo icon Genoo20+ installs do_action( 'wpseo_head' ) libs/Genoo/Frontend.php:865
  6. WPMktgEngine icon WPMktgEngine20+ installs do_action( 'wpseo_head' ) libs/WPMKTENGINE/Frontend.php:852
  7. Settings for WooNuxt icon Settings for WooNuxt10+ installs do_action( 'wpseo_head' ) includes/graphql/yoast.php:71
  8. Social Feed Sync & Link to Post icon Social Feed Sync & Link to PostFewer than 10 installs do_action( 'wpseo_head' ) frontend/template/social-feed-sync-template.php:61

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.