Victor Ferreira Victor Ferreira - 1 year ago 62
PHP Question

How to add content to the HEAD tag on dashboard/wp-admin

I want to add some content (actually some scripts) to the wp-admin pages, so it will run on the media page, on posts page and all the other pages on the dashboard.

So I added this to the


function test() {
// Your PHP goes here
echo 'hello';
add_action( 'wp_head', 'test' );

But nothing happens. I also tried this wp enqueue script, but nothing seems to happen. I only need this on the dashboard.

Could someone help?

Answer Source

Try this

For script

function my_enqueue() {
      // your script

add_action('admin_enqueue_scripts', 'my_enqueue');


function add_php_data() {

    // Do some stuff.


add_filter('admin_head', 'add_php_data');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download