As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [wp-head]

Uses do_action() Calls 'wp_head' hook.

Filter by
Sorted by
Tagged with
3 votes
2 answers
4k views

Edit title-tag in wp_head with yoast seo

I want to manipulate the html-title tag, so <title> these not the content of the title-tag! I use child-themes and it's inevitable, because the template have to be easy to update. So I have to ...
Wombat's user avatar
  • 31
0 votes
2 answers
179 views

Is this a bad approach to add conditional comments to wp_head?

Why people say this is a bad approach to add conditional comments to wp_head? For example: function add_ie_html5_shim () { echo '<!--[if lt IE 9]>'; echo '<script src="http://...
user2569737's user avatar
1 vote
2 answers
4k views

Remove Genericons Helper CSS from twentyfourteen theme

I'd like to remove the genericons-css styles loaded by default into twentyfourteen theme. <link rel='stylesheet' id='genericons-css' href='http://ffwdconsulting.com/wp/wp-content/themes/...
Pico's user avatar
  • 111
1 vote
0 answers
189 views

How to modify default controls in Wordpress theme customizer

I'm trying modify the default control in the wordpress theme customizer specifically the action for the close button. By default clicking it will make you go back to the themes page, but I want it to ...
Wern Ancheta's user avatar
0 votes
1 answer
190 views

jQuery does not appear to be enqueued on static homepage

I have been searching why, but I am clueless, I cannot figure out what is happening... jQuery does not appear to be enqueued on static homepage (I am not used to work with static homepages). On ...
Eva's user avatar
  • 3
2 votes
1 answer
2k views

Filter out some plugin action in wp head / wp_footer

I am using a plugin called "syntaxhighlighter". I know not to ask for plugin specific questions but rather how to filter out action added to the wp_head / wp_footer conditionally... This is a ...
Sagive's user avatar
  • 2,772
0 votes
1 answer
52 views

How to find which plugin is outputting Open Graph tags to <head>

After getting an error the Facebook debugger about duplicate og:url tags, I'm trying to find which plugin is outputting the second set of Open Graph tags to my head section. I've tried deactivating ...
Joe Hallissey's user avatar
7 votes
5 answers
28k views

Remove meta robots tag from wp_head

I am in need to remove just this line <meta name=robots content="noindex,follow"/> from wp_head but can't find the right hook to use it with remove_action(). <meta name=robots content="...
elvismdev's user avatar
  • 300
0 votes
3 answers
8k views

Why does wp_enqueue_script ignore my 'wp_head' hook?

I would like css_head_scripts and js_head_scripts to be appended to wp-head but Wordpress completely ignores it? Am I missing something? function css_head_scripts() { wp_enqueue_style( '...
Wilhelm's user avatar
  • 181
0 votes
1 answer
30 views

Is it possible to add post specific info in head of worpress post for OG use

Im trying to implement this OG features on my site. http://www.jwplayer.com/blog/publish-your-videos-to-facebook-with-a-jw-player/ Is it possible to get post title, thumbnail url, and place it in the ...
Charles Wayne's user avatar
1 vote
3 answers
7k views

Manipulating wp_head content

I'd like to know if it is possible for me to manipulate the output of wp_head()? Right now I'm using the Yoast SEO plugin to add some social tags into my posts (og:*). Now this site is an remake of ...
tommica's user avatar
  • 21
0 votes
1 answer
167 views

Removing action from template class

I'd like to replace an action in a theme with my own version in a child. In this case, the theme hooks into wp_head to add it's own links. My own functions.php resides in the child theme and looks ...
Christian Macht's user avatar
1 vote
1 answer
680 views

Proper after_setup_theme and wp_head cleanup

Im trying to clean up code in my theme a little bit, remove some of the code that is not used and basically do things the right way, to decrease load time etc. Currently I have this code: add_action(...
Richard Mišenčík's user avatar
1 vote
2 answers
4k views

How To Make Sure That My Action Hook Executes Last

How can I make sure that my_function action hook on 'wp_head' is executing last? One hack, that I'm using, is to give 999999 (a big number) as the third argument. But maybe some other hook on 'wp_head'...
Omar Tariq's user avatar
0 votes
1 answer
113 views

wp_head hook content showing up at top of RSS feed

The RSS feed for a site I maintain recently stopped working. I did a little investigating and found that the wp_head hook contents of several plugins is getting injected at the top of the page, ...
jdp's user avatar
  • 156
2 votes
4 answers
19k views

add action wp_head not working

I am trying to add some code to the head (namely a block of tracking script) via a plugin I am making. The plugin has an interface where the user enters some details which are then added to the ...
robolist's user avatar
0 votes
4 answers
1k views

Function to echo (or display?) wordpress tags in the head section

I can't figure this out but I'm trying to echo the post Tags of the post in the <head> section. This code resides in the <head> section of the site. Basically I want the post tags to ...
Liwii's user avatar
  • 1
2 votes
2 answers
4k views

How can I make new .css file in child theme override styles in child theme's style.css

I want to make a separate responsive.css file in my child theme but having trouble making the media queries override the styles in the child theme's default style.css. I've tried putting <link rel=...
user1794295's user avatar
0 votes
1 answer
156 views

Unable to apply selective loading

I wanted to get rid of unnecessary calls in my header. I would like a plugin 'wizylike' to load only on 'posts', nowhere else ( archives, pages etc.). I have taken a hint from this thread on how to ...
gurung's user avatar
  • 432
1 vote
1 answer
2k views

Add javascript to wp_head with call to plugin options?

I am trying to write a plugin in wordpress and have been doing it in stages, I understand how to add javascript to the wp_head however adding multiple function calls to the plugins options is ...
phoenixlaef's user avatar
0 votes
0 answers
199 views

why php tag is not working if i store and show it in wp_head?

hi i used wp_head a couple of times.I echoed some values it works like below function test() { echo "hello am visible"; } add_action('wp_head','test'); but if i store a php code in db and retrieve ...
sun's user avatar
  • 581
3 votes
5 answers
16k views

Add code into <head> on a per page/post basis

Is there plugin (or an easyish way) to add code to the <head> section on a per page/post basis? I have a multilingual website and I need to implement the rel="alternate" hreflang markup, so ...
moobot's user avatar
  • 148
9 votes
8 answers
14k views

How to add stylesheets only to pages with specific shortcode?

I'm running a function on pages where the shortcode [make-me-a-map] is used. It enqueues javascript to the page and makes a map. That part works fine (woot!) but I'm having trouble with adding the ...
Padraic's user avatar
  • 93
-2 votes
1 answer
687 views

Use Wordpress Built In Jquery

I see that on every page Wordpress is loading in jquery, how do I go about using that jquery as it keeps telling me that it doesn't recognize $ or $noConflict(); - I'm trying to add some jquery under ...
Howdy_McGee's user avatar
  • 20.3k
0 votes
1 answer
5k views

How do I find the code executed when wp_head() is called?

I am working on editing the header.php file and I am a bit confused. I am editing the header.php file and I see a call in it to wp_head(); I know that it calls a "callback function" with something ...
Genadinik's user avatar
  • 231
2 votes
2 answers
13k views

add_action and wp_head not display content in head section

I have a big problem. In a Wordpress page I've a function that generate og meta tags. I want to "append" that generated meta in the head section. So, I write this code: add_action('wp_head', '...
apanzett's user avatar
1 vote
1 answer
4k views

wp_head() - list hooked actions with priorities?

I'd like to add something to wp_head() but I'm aiming precise location (like after style.css but before rtl.css and before my other custom script). I'm wondering if it's possible to list everything ...
Paul's user avatar
  • 2,100
0 votes
1 answer
133 views

output specific location in the header

Is there a way in which I can output some code in the header and choose it's location? some where like wp function add_admin_menu (where you can choose the placement).
user1888564's user avatar
5 votes
2 answers
19k views

How can I modify what is being output in wp_head, whether by a theme or Wordpress in general?

I've been working on performance of my site using YSLOW, and noticed that Wordpress it outputting things in my document head that I know I don't need. For example, I'm already calling jQuery 1.9 from ...
Joel Glovier's user avatar
0 votes
1 answer
2k views

Why won't the action hook wp_head accept parameters?

I'm working on a plugin that adds scripting to the head using add_action('wp_head',..); I have to pass a variable to the function to get my desired result. To test this I'm simple "echoing" out the ...
dcp3450's user avatar
  • 455
0 votes
2 answers
420 views

Display Something in the Header After All Styles are Loaded

I'd like to include a functionality in a theme that will overwrite styles from previously included CSS files. For this purpose, I need to be able to display a <style> in the header after ALL ...
Dzhuneyt's user avatar
  • 152
1 vote
2 answers
9k views

How do I edit wp_head and/or functions.php to remove rss-feed which isnt used and dont validate?

When using w3.org's validation tool Unicorn I get the following error/warning: URI: http://energyshop.se/hem/feed/ This feed does not validate. After looking into my source its there crystal clear ...
Emanuel Olsson's user avatar
0 votes
1 answer
543 views

Can't find where to modify <html> attrbitutes

I am trying to create a simple function that adds or edits data in the <html>. Basically, before the server response is sent, I want to find where this piece of html is written at the top level ...
Nathan's user avatar
  • 149
-1 votes
1 answer
116 views

new to javascript - using in <head> instead of functions.php, not loading correctly

Live site. I've decided to incorporate javascript in my new theme; this is my first time doing so and have pieced together what I've down with help of blog posts and forums. I have the javascript ...
user1255049's user avatar
1 vote
2 answers
828 views

CSS from textarea in options page to frontend what to do

I have a textarea for small css enhancements on the plugins page i output them directly to the head. My Question is how to sanitize the CSS i have validation function registered for the options with ...
James Mitch's user avatar
-1 votes
1 answer
683 views

How can a 'scripts' directory be hooked into wp_head();?

So I'm trying to get my head round <?php wp_head(); ?>. I understand that it loads in the stuff needed for plugins etc., but I'm using a theme that seems to be using it to load in scripts for ...
suryanaga's user avatar
  • 121
5 votes
1 answer
2k views

Multi-page posts do not get indexed by Google due to canonical URLs

I've just noticed that on my paginated posts, only the main page gets indexed in Google. The paginated posts "post-title/2" and "post-title/3" for example, do not get indexed. On closer inspection, ...
N2Mystic's user avatar
  • 3,153
0 votes
1 answer
952 views

Would there be anything stopping me from removing both wp_head and wp_footer?

Some plugins rely on either wp_head or wp_footer or both to introduce their own stylesheets and JavaScript. Those scripts take time to load and slow down my website. Therefore, I would like manually ...
ericn's user avatar
  • 420
1 vote
1 answer
144 views

How do I test my localhost WordPress project with VirtualBoxVM?

I'm working on a WordPress project set up with MAMP on localhost. I try testing the site on internet explorer with VirtualBoxVM by browsing to my local ip. My problem is, wp_head() outputs absolute ...
Mathias's user avatar
  • 53
0 votes
1 answer
565 views

colorbox not loading in <head>

I can not get colorbox fully loaded. I am trying to add color box to use in my plugin admin. I do not need it for the front end. I can get the css but can not get jquery.colorbox-min.js or the ...
Jason's user avatar
  • 606
2 votes
2 answers
4k views

How to remove unnecessary elements in the HTML document head

Is there a plugin or something that can help me out with deleting unnecessary elements in my code? I am in charge of fixing a WordPress site and have been asked to remove the following elements that ...
Manna's user avatar
  • 137
0 votes
1 answer
10k views

Echo a div to header.php from functions.php

Within the section of header.php I have a div structure <div id="header"> <div id="masthead"> <div id="branding"> ... I want to add a div within "branding" - I can do this ...
Skip's user avatar
  • 55
4 votes
3 answers
2k views

How can I reduce the amount of files loaded/included per plugin?

I have a Wordpress site that uses several plugins, namely 8. Most of these plugins include a lot of their own JS and CSS files, some even include so much as 3 separate CSS files. One can imagine that ...
Joey's user avatar
  • 143
3 votes
5 answers
2k views

Indenting (tabbing) WP_head

Right now all the stuff that gets included in wp_head are left justified all the way in the code view. Whereas all my other code that is around the wp_head is indented (tabbed) two times. Is it ...
mr. x's user avatar
  • 53
2 votes
2 answers
2k views

wp_head() not including styles and javascripts after a template redirect

I am using the template_redirect action to redirect a user to a custom template which has no header, sidebar or footer (the intent is for it to be in an iframe as a dialog box). After I done the ...
Extrakun's user avatar
  • 1,004
1 vote
2 answers
6k views

adding meta data using plugin to top of head

It seems if you use the wp_head hook as an action to put your custom metadata into the head tags of your page, it is dependent on where the theme you are using calls the wp_head. In my case, it is at ...
Derek W Beck's user avatar
2 votes
1 answer
2k views

Using auth_redirect returns cannot modify header information

I'm hooking auth_redirect to wp_head, but it's returning cannot modify header information. Do I have to hook it to a different action? Something that loads before wp_head? I tried hooking it to ...
zen's user avatar
  • 171
-1 votes
1 answer
1k views

Adding a wp_head hook from an included PHP file

I am using a WordPress plugin for including PHP code within posts and pages, and it's working great - however, I need to insert some styles and scripts, and in order to do that, I need to add a hook ...
Jeff's user avatar
  • 101
0 votes
1 answer
217 views

Background of default template showing instead of the background of custom page template

Plugins were not working for my custom page template, found out that I needed to put WP_head() and WP_footer(), so did that and the plugins started to work. But now the background changed to that of ...
Seal's user avatar
  • 11
0 votes
1 answer
35 views

Post Attachment missing head (stylesheets/js/what-not)

I am using a modified 2011 theme, I got the single post to look fine but my single attachment is not working. I'm told this will default to the page.php if I do not have an attachment template. So, ...
Alex's user avatar
  • 1