Quantcast
Channel: Wordpress API - Developer Code Book » wp tutorials
Viewing all articles
Browse latest Browse all 10

how to inject the html code into wordpress head

$
0
0

Many wp developers asked me same question multiple times. How to push the some HTML code into the wordpress head section. It is quite easy to push or inject the the some HTML code into the head section.There are multiple WP plugins which are giving this facility the push the HTML code into the head section. If you don’t want to use the WP plugin then you can use my code snippet for inject the code into wordpress head section.

If you are WP theme developer then you can use following code.

 function WPAPI_init() {
echo "YOUR_HTML_GOES_HERE";
if (is_admin()) {
echo "YOUR_HTML_GOES_HERE";
}
 }
 add_action('wp_head', 'WPAPI_init');

You need to put above code into functions.php file which you find in themes folder.

If you are WP plugin developer then you can put above code into your plugin file.


Viewing all articles
Browse latest Browse all 10

Trending Articles