I needed a very simple way to custom styles or scripts to the <head>, and I didn’t really want to customize the theme.
add_action( 'wp_head', 'wp_head_custom_field' ); function wp_head_custom_field() { if ( is_single() ) { global $post; $html = get_post_meta( $post->ID, 'wp_head', true ); echo $html; } }
With this, I just needed to add my pre-formatted javascript or css to a custom field called ‘wp_head’ and it would then be added to the <head> just like I needed. I added the is_single()
as a precaution.