Forums

[resolved] Need to determine if an action is being called by the admin site (is_admin?) (3 posts)

  1. DaveUK
    Member
    Posted 6 years ago #

    Hi

    I am developing my very first plug-in which is extremely simple and yet I have managed to bugger it up :)

    I have hooked wp_head so I can insert a new script tag into every page header and it works for the main site but when the plugin is activated on the admin side I get an error telling me the

    Now, I dont actually want the script included for admin pages so what I would like is some sort of function like is_admin() but i have searched this page (http://codex.wordpress.org/Conditional_Tags) and there seems to be nothing.

    Thanks in advance

    The full code for my plug in is below for reference:

    add_action('wp_head', 'add_mint_javascript');

    function add_script($unused) {
    echo '<script src="/my.js" type="text/javascript"></script>';
    }

  2. DaveUK
    Member
    Posted 6 years ago #

    sorry I didnt finish a sentence in the above post...

    ... I get an error telling me the headers can not be modifid because they have already been written.

  3. DaveUK
    Member
    Posted 6 years ago #

    I think this must have been some sort of funny character in my plug-in somewhere because it mysteriously went away when I reshuffled the file.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags