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:
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.
-
Yoast SEO10+ million installs
do_action( 'wpseo_head' )src/integrations/front-end-integration.php:457 -
FunnelKit30,000+ installs
do_action( 'wpseo_head' )modules/checkouts/compatibilities/others/class-seo-wp.php:33 -
AMP WP600+ installs
do_action( 'wpseo_head' )includes/class-amp-wp-plugin-compatibility.php:746 -
WP Theme Optimizer400+ installs
do_action( 'wpseo_head' )public/class-wpto-public.php:201 -
Genoo20+ installs
do_action( 'wpseo_head' )libs/Genoo/Frontend.php:865 -
WPMktgEngine20+ installs
do_action( 'wpseo_head' )libs/WPMKTENGINE/Frontend.php:852 -
Settings for WooNuxt10+ installs
do_action( 'wpseo_head' )includes/graphql/yoast.php:71 -
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.