Title: Adding javascript to header
Last modified: August 19, 2016

---

# Adding javascript to header

 *  [ocon](https://wordpress.org/support/users/ocon/)
 * (@ocon)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-javascript-to-header/)
 * For my first plugin, I’m trying to add a line of code into the head of the edit
   user profile page. I’m not able to get it to work:
 * `<?php
    /* Plugin Name: user profile js Plugin URI: Description: Add javascript
   to edit user profile page Author: Version: Author URI: */
 * function my_header_content(){
    echo "<script>...</script>";}
 * add_action("edit_user_profile","my_header_content");
 * ?>
 * Any help is appreciated

Viewing 1 replies (of 1 total)

 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/adding-javascript-to-header/#post-1292094)
 * ‘edit_user_profile’ runs long after the head has been closed. Its not going to
   insert anything into the head section of the page. You should be looking at [wp_enqueue_script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Load_scripts_only_on_plugin_pages),
   admin_head, and admin_print_scripts.

Viewing 1 replies (of 1 total)

The topic ‘Adding javascript to header’ is closed to new replies.

## Tags

 * [admin](https://wordpress.org/support/topic-tag/admin/)
 * [edit user profile](https://wordpress.org/support/topic-tag/edit-user-profile/)
 * [header](https://wordpress.org/support/topic-tag/header/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 1 reply
 * 2 participants
 * Last reply from: [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/adding-javascript-to-header/#post-1292094)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
