Articles of wp head

Deregister CSS style file from WP footer

When user is logged in WP add in its footer this CSS: <link rel=’stylesheet’ id=’open-sans-css’ href=’//fonts.googleapis.com/css?family=Open+Sans….’ type=’text/css’ media=’all’ /> That style is not registered inside my theme, if I change my theme I still have that file called in any theme, it is somewhere inside WP core files. How to remove it?

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’, ‘myoverride’, 100); function myoverride() { remove_action(‘wp_head’, array(visual_composer(), ‘addMetaData’)); } it works and removes it. But what I want is to remove it IF installed, because if […]

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 get_headers and send_headers, but then it didn’t even work. Any ideas? Thanks! add_action(‘wp_head’,’check_if_logged_in’); function check_if_logged_in() { $pageid = get_option(‘sd_page_id’); if ( !is_user_logged_in() && […]

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 that is attached to wp_head() in execution/display order anyhow? I know that I can pass priority/order parameter to add_action but I need to […]

action hook wp_head higher priority as all other plugins/hooks

I work a bit with the wordpress API and I want to try to include a <meta>-tag into my head area of my website. This is my code (works everything fine!): class dmd_noindex_options_page{ function __construct() { add_action( ‘wp_head’, array( $this, ‘set_meta’) ); } function set_meta(){ $pages = get_option(‘dmd_noindex_pages’); $pages_id = explode(‘,’, $pages); for($i = 0; […]

Hook into wp_head(); in a plugin

I am following a tutorial that requires I put this code above wp_head(); <?php $example_position = get_theme_mod( ‘logo_placement’ ); if( $example_position != ” ) { switch ( $example_position ) { case ‘left’: // Do nothing. The theme already aligns the logo to the left break; case ‘right’: echo ‘<style type=”text/css”>’; echo ‘#main-header #logo{ float: right; […]

wp_head hook by page ID

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” /> <?php } It works fine, but I would like to use a conditional tag like if ( is_page(‘4’) ) So I can use different meta tags for specific pages.

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/twentyfourteen/genericons/genericons.css?ver=3.0.2′ type=’text/css’ media=’all’ /> I followed How to remove CSS file in the header using WordPress functions? with this code: function dequeue_my_css() { wp_dequeue_style(‘genericons-css’); wp_deregister_style(‘genericons-css’); } add_action(‘wp_enqueue_scripts’,’dequeue_my_css’); but doesn’t work. Link to css still shows up in the header.

Modify page title format (when using title-tag)

Currently my page titles are handled by WordPress, in a call to wp_head (I have add_theme_support( ‘title-tag’ ) in functions.php). I’d like to change the page title format for category archives – currently these look like <Category name> Archives – <Site name> I’d like them just to be: <Category name> – <Site name> Is there […]

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 in the <head>: <link rel=”alternate” type=”application/rss+xml” title=”energyshop.se &raquo; Hem kommentarsfl√∂de” href=”http://energyshop.se/hem/feed/” /> Now, how do I remove this feed since I dont use it? Thanks in advance!