wp_head()WP 1.2.0

Fire the wp_head action.

See wp_head.

Hooks from the function

Return

null. Nothing.

Usage

wp_head();

Examples

0

#1 Mandatory function call in the header of any theme

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 </head> tag of your theme (in header.php):

<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="viewport" content="width=device-width" />

	<?php 
	/**
	 * wp_head() must always be in front of </head>
	 * otherwise the work of many plugins will be disrupted, which
	 * use this hook to add their codes to <head>. These are:
	 * styles, scripts and meta tags.
	 */
	wp_head();
	?>
</head>

Changelog

Since 1.2.0 Introduced.

Code of wp_head() WP 5.9.3

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