wp_head()

Fires the wp_head action.

Description

See ‘wp_head’.

Source

function wp_head() {	/** * Prints scripts or data in the head tag on the front end. * * @since 1.5.0 */	do_action( 'wp_head' ); } 

Hooks

do_action( ‘wp_head’ )

Prints scripts or data in the head tag on the front end.

Changelog

VersionDescription
1.2.0Introduced.

User Contributed Notes

  1. Skip to note 3 content

    Example. Plugins and WordPress core use this function to insert crucial elements into your document (e.g., scripts, styles, and meta tags). Always put wp_head() just before the closing tag of your theme (usually in header.php):

    <head>	<!-- First add the elements you need in <head>; then last, add: -->	<?php wp_head(); ?> </head>
  2. Skip to note 4 content

    Add a pingback url auto-discovery header for single posts, pages, or attachments.

    if ( ! function_exists( 'wpdocs_pingbackurl_example' ) ) {	function wpdocs_pingbackurl_example() {	if ( is_singular() && pings_open() ) {	echo '<link rel="pingback" href="' . esc_url( get_bloginfo( 'pingback_url' ) ) . '">';	}	} } add_action( 'wp_head', 'wpdocs_pingbackurl_example' );

You must log in before being able to contribute a note or feedback.