Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [wp-head]

Uses do_action() Calls 'wp_head' hook.

0
votes
2answers
21 views

Removing auto versioning of JS and loading to header

I want to remove the JS I added and gets versioned by wp. I have a js script called base.js, and wordpress loads that by itself like <script type="text/javascript" src="../base.js?ver=4.9.9">&...
0
votes
0answers
15 views

Wp_head () affecting my images layout

So, I was trying to create a grid with different sizes, where when you clicked the image would zoom out and show the whole image. For this I need to apply overflow hidden so the images dont lose their ...
0
votes
0answers
10 views

How do I get a reference to the HTML memory buffer while the page is being constructed?

I want to view & update the buffer with html "<head>" data section in it, after the head has been generated. Problem statement: I have created some shortcodes in a plug-in which, if ...
0
votes
1answer
13 views

How to add meta tags inside single image page?

Hello im trying to add custom meta tags from facebook share button inside image.php file , and i dont know why they dont display, this is how my code looks: function add_facebook_image_code(){...
0
votes
1answer
12 views

Inserting article:tags meta in html head-element, using get tags, no wp_head

I´m trying to add code to a template file of mine, working with a raw theme I generated from “”. The file is a duplicate of single.php and called single-post.php. Like WP states in Codex. I am trying ...
0
votes
1answer
82 views

Remove CSS & JS from <?php wp_head(); ?>

I've been with this problem for a couple of days and the truth is that I can not find a solution. I have added code manually in wp-header.php and now I need to delete these lines that it generates ...
0
votes
1answer
23 views

How can I pass a shortcode value to the head in wordpress functions.php

I'm trying to create a shortcode for charts on wordpress posts. So far I've got the shortcode working and I can see the shortcode values are being passed through, but what I need to know is how to ...
1
vote
1answer
83 views

Custom plugin - $post_id in wp_head

(english is not my language so I'm sorry if I don't explain really good) My custom plugin get an URL from custom metabox and add it into the header.php My problem is that I can't get $post_id in my ...
0
votes
1answer
63 views

Run shortcode in custom script in wp_head if post type is CPT 'Jobs'

i am using genesis framework and types plugin. i create post meta fields for a custom post type name 'jobs' i want to run a custom javascript named jobpostingschema.js in wp_head if post type is ...
-1
votes
1answer
24 views

Add PHP code to header section from plugin

How can i add any type of PHP code to header section through plugin programmatically ? I did use add_action('wp_head', 'your_function'); function your_function() { echo ...
0
votes
2answers
40 views

How can I change the <head> tag contents of individual Wordpress posts?

How can I change the tag contents of individual Wordpress posts? I want to add a meta tag for keyword. I use Yoast SEO but even though I specify the focus keyword, no keyword is added in the meta ...
5
votes
2answers
547 views

Removing specific style from wp_head

I'm not a WordPress developer, I'm trying to help a friend who has a WordPress website. Here is the problem: In the template, wp_head() function adds bunch of styles and scripts. I want to remove ...
0
votes
1answer
42 views

Modifying meta tags after doing ajax call in plugin

I have a plugin that will automatically load articles from a news publisher by checking query vars in the URL. If an article was requested, it does an AJAX call to this publisher, creates a new ...
0
votes
0answers
57 views

How to store wordpress functions (wp_head(),wp_footer()) in a javascript variable?

how to store wp_head() and wp_footer() in a javascript variable ? var s = ''; <?php ob_start(); wp_head(); wp_footer(); $string = ob_get_contents(); ob_end_clean(); var ss = '&...
1
vote
1answer
105 views

storing wp_head in a variable?

how to store WP_head and footer functions in a variable? Is that possible? I wanted to be like this. $var = wp_head(); How can achieve it?
0
votes
2answers
581 views

Why wp_head() function not loading style.css?

I am totally new to WordPress and developing my own theme but function.php is not loading CSS file. header.php <html> <head> <?php wp_head(); ?> &...
0
votes
1answer
373 views

wp_head() outputs in body

I've got a simple header file which calls the wp_head method, however when i inspect the source the css links are made in the body and the <head> is empty. My header.php: <!DOCTYPE html>...
1
vote
2answers
140 views

Replace category titles

I want to display different titles in category archives than the category title. I have created a function with if statements for this purpose: function category_titles_change() { if (...
0
votes
1answer
941 views

How do I override WordPress plugin css [closed]

I recently tried to add custom css to one of my stylesheets for my theme to customize a WPBakery Page Builder button element. But I saw that the plugin(WPBarkey Page Builder) overrides the css I set ...
0
votes
2answers
518 views

Change default s.w.org dns-prefetch resource hint value

By default, wp_resource_hints() prints hints for s.w.org, I am trying to change the default printed value. I am not trying to get rid of the hook, I indeed need it and want to use it, however witout s....
0
votes
1answer
677 views

Different favicon on different pages?

Is it possible to put Favicon on a specific page ? For example : mywebsite.com/blog1 -> Favicon1 mywebsite.com/blog -> Favicon2 And so on. Because later I'll put custom domain name for ...
2
votes
2answers
10k views

Add <meta> tags to the <head> section via functions.php

I've got a custom theme I've developed and it's basically a 4 page brochure site for a client and I've managed to do away with a few plugins by building in custom-post-types, gzipping via .htaccess ...
1
vote
2answers
273 views

Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?

I need unregister this enqueue style of wp_footer() hook and add it to the top of site with hook wp_head(), this is possible? I'm optimizing my theme to validate in W3C, and one of the requirements ...
1
vote
3answers
2k views

How to load different css file for different pages

I have several different pages. Every one of them has different css links. Rather than the css links all items are same in the head element of those pages. I need to shift those head element to header....
1
vote
1answer
340 views

Header has extra HTML block at top before my code

I've been trying to fix the issue where wp_head loads in the body tag in wordpress, and I've discovered that when I look at the page source, an extra HTML block appears before the code from my header....
0
votes
1answer
3k views

“Warning: count()” printing in Page templates

I recently made a local copy of an existing site to make development changes. Most everything is working fine in the local version, except that at the top of any Page I see this error (sometimes more ...
0
votes
1answer
167 views

Update javascript URL in header - Domain Mapping Plugin [closed]

I am seeing the following script being called in my wp_head(); it is associated with the Domain Mapping plugin. <script type="text/javascript" src="http:/mywebsite.com/dm-sso-endpoint/1510878861/?...
1
vote
1answer
811 views

wp_head hook by page ID [closed]

I need help with this /* meta description to head */ add_action( 'wp_head','carlos_head_meta_page' ); function carlos_head_meta_page() { ?> <meta name="description" content="vale here"...
0
votes
1answer
420 views

Front End Page Not Loading Header Footer

I followed the directions at http://blog.frontendfactory.com/how-to-create-front-end-page-from-your-wordpress-plugin/ and it works but the header and footer do not load. Here is my page: http://...
0
votes
0answers
22 views

Placing CSS/ JS into the header or footer (inline) - trying to apply to several templates

The below code works perfectly well thanks to this help from a previous question I posted. The code that I've posted directly below injects CSS (or JS) into the wp_head of WordPress.... My question ...
2
votes
0answers
39 views

Trying to inject twitter metadata into <head> using wp_head action in functions.php - get_the_excerpt() returns null

So I followed the "Add Twitter Cards without plugins" this tutorial for how to add twitter metatags into the header using the wp_head method. I have pretty much taken the code as is, and put it in ...
0
votes
1answer
56 views

Wrong image path within inline styles in the head

I'm adding some inline styles to the <head> using file_get_contents(some-style.css) and the wp_head hook. My relative image paths don't work once they are added to the head, although they do ...
0
votes
0answers
49 views

How can I edit a meta description

A shortcode that I'm using in the beginning of each post is somehow getting into the meta description. After trying to figure out why I decided to simply do a preg_replace for the meta description, ...
0
votes
1answer
274 views

Load admin bar without wp_head or wp_footer

Is there any possible way to load admin bar without wp_head or wp_footer? If no, so maybe there is a way to load wp_head() or wp_footer() to catch only admin bar functions, styles and scripts? Is this ...
1
vote
0answers
305 views

wp_head function causes 30px blank space [closed]

I want my outer-wrapper to be full screen, but if use wp_head(); function it causes nearly 30px blank space from the top. If I use #outer-wrapper: margin: -30px auto; this time there is 30px blank ...
0
votes
2answers
733 views

How to properly insert a stylesheet in wp_head

I am generating critical CSS for every page and category. At the moment I am inserting the stylesheet through functions.php like this simply using echo. function criticalCSS_wp_head() { if (...
0
votes
1answer
17 views

Edit meta fields from within template

I am sure this has probably been asked before, but I've tried all sorts of searches and cannot find a definitive answer. Maybe it's just not possible! I have a directory of users (displayed using an "...
0
votes
2answers
420 views

Add inline style to pages where shortcode was used

I am trying to add a style to the header, using this method the style only loads on single posts but if I use a shortcode to load the post content that style does not load in the header: add_action( ...
0
votes
3answers
3k views

Remove meta description on certain pages

Wordpress renders a meta description tag with the content of the blog post as the value for the description. I already generated in the header.php what I want the description to be, no matter what. ...
1
vote
0answers
250 views

wp_head function not outputting

I've been trying to figure out what I could possibly be doing wrong with this plugin I just coded, from what I see, everything should be working correctly. However, it's not doing anything at all. No ...
1
vote
1answer
792 views

Removing Visual Composer head meta (works alone but not with IF)

I'm trying to remove the head meta added by VC, namely "meta name="generator" content="Powered by Visual Composer - drag and drop page builder for WordPress". If I add: add_action('init', '...
0
votes
1answer
36 views

Calling JavaScript for specific page irrespective of whichever theme you select

I recently added a JavaScript file that pulls JSON data and updates the div tag on specific page of my WordPress, now to apply the JavaScript file to the page I added to header tag in the theme and ...
1
vote
1answer
682 views

How can I get wp_head() as a string instead of echoing it?

I'm using PHP handlebars templates and would like to keep all of the HTML in the template file so I don't have a header.php but rather the handlebars looks like <html> <head> {{#...
3
votes
2answers
104 views

Track down where script is being enqueued from

I have a WordPress site with an SSL certificate. It all works fine, except that this little insecure shield icon shows up because the header has an enqueued non-https script. The issue is that I ...
-1
votes
0answers
330 views

wp_enqueue_script is not loading scripts at all

Currently I am working on a magneto project which includes a wordpress blog, after updating my server i am unable to access my blog. after spinning head on it (i have zero knowledge of wordpress) i ...
0
votes
1answer
879 views

Auto Generated HTML source code formatting

I've had this question for a long time and I was wondering if anyone had an answer for it. I know its not really important, but for someone like me who really likes very clean markup things like this ...
0
votes
3answers
8k views

Remove all theme CSS & JS from wp_head (but only for 1 page template)

I have a page template, which is working nicely. But when I include , it loads the themes CSS and js files, which breaks my page template. However, I still need the wp_head for some plugins to work. ...
1
vote
1answer
11k views

How can i remove JUST the title tag from wp_head() function?

i'm using wordpress 4.6 i'd like to remove just the title tag automatically outputted by wordpress because need to hardcode the html title tag in the template. i guess is something like this: ...
0
votes
1answer
130 views

Adding code to head to all pages manually

I've been googling for days and I didn't find a solution. I need to add a JS code to the head of all my pages, and I wanna do that manually (without a plugin). I found a '~/wp-content/themes//header....
0
votes
2answers
762 views

Include HTML (Bootstrap Modal Box) with a plugin into my header

I want to include some HTML, spezific a bootstrap modal box. This is my function with the HTML part: public function dmd_fav_modal_box() { $content = '<div class="modal fade" id="...