Questions tagged [wp-head]
Uses do_action() Calls 'wp_head' hook.
232 questions
1 vote
0 answers
95 views
Removing unnecessary CSS and JS code from wp_head()
I am using Wordpress in headless mode and write articles using Gutenberg, for convenience. I am also using third-party plugins that I need to embed on the page and for this I use the wp_head() ...
0 votes
0 answers
55 views
<?php wp_head(); ?> and <meta property="og:title"
I'm a newbie in wordpress, I have made a site. All works well, except for this: when I try to share my homepage in social the preview was strange only a name call HOME and a "[" in the ...
0 votes
1 answer
86 views
<meta name="robots" duplicate issue
I use WordPress i have a problem on I have inspected my site and there are 2 meta tags <meta name='robots' content='index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' /&...
0 votes
0 answers
153 views
Execute a PHP Function when a Block is used and access it's attributes
I've just build my first block using the @wordpress/create-block package. Everything is working as expected however I need to access the attributes on save and place a script containing a JSON schema ...
2 votes
1 answer
1k views
Add additional scripts and markup in the <head> section of default Gutenberg theme
I'm getting used to the new Gutenberg system and want to add some lines in the section. I peeked inside the header.html file of the default Gutenberg theme, inserted some code, but it's not showing ...
1 vote
1 answer
807 views
Why does add_action() not run when placed in register_activation_hook()?
I have questions about executing add_action() in a Wordpress plugin. I was attempting to insert into the tag via the plugin i wrote. I had this (which never ran, btw) function tt_add_GA4_header() { ...
0 votes
1 answer
2k views
How to modify default <meta> tags in wp_head()
I am looking to do some on-page SEO, wherein I want to limit the length of Title, Description, and more in my HTML meta tags. Is there anyway I can access metatags already present in wp_head, and ...
1 vote
2 answers
275 views
Why callback function is not working in wp_head hook?
I have two versions of the simplest function that hooked to the wp_head action. One is working, andother one is not. Can someone explain? // Works ! function custom_description() { ?> ...
0 votes
1 answer
110 views
wp_head not injecting css
I'm trying to inject a style.css script into my front-page.php. None of the styles load. In the tutorials, when you inspect page source, all the CSS should be there, but it simply shows the wp_head() ...
-1 votes
1 answer
56 views
Reading the inside of <head>
I am writing this because I am confused about whether it is possible to read the head tags when I'm in admin. Searching for queries like "reading wordpress" return how to add code to ...
0 votes
1 answer
284 views
How to add css to wp_head depending on the user role?
I think this question should have an easy answer for any developer but maybe I am wrong. As much as I think, I can not understand why this snippet does not work to add a css style to the head ...
3 votes
0 answers
212 views
Is there a way to prevent wp_head from outputting self-closing tags?
I'm a beginner in WP development, so maybe I'm missing something obvious. Is there a way to prevent wp_head from outputting self-closing tags? Here are two example lines taken from my website: <...
1 vote
0 answers
110 views
How to manipulate the content within wp_head
I am looking to create a plugin which will allow me to update content within the wp_head function. I have the below code which is fine in allowing me to add new content during the wp_head load event; &...
0 votes
1 answer
62 views
How to replace the existing metatag using the backend to insure a thumbnail image gets fetched when we share on social media?
How to replace the existing metatag using the backend to insure a thumbnail image gets fetched when we share on social media? function theme_a_header_metadata() { global $post; $image = \...
0 votes
1 answer
115 views
Adding Plugin Assets to Header
I am creating a WordPress Plugin. I have already added some pages. But I want to add custom CSS to that pages in the <head>. I am trying: add_action( 'wp_head', 'DisHeaderAssets'); But nothing ...