Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7862117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:00:23+00:00 2026-06-02T23:00:23+00:00

This must be an easy question for those who are not new to WordPress

  • 0

This must be an easy question for those who are not new to WordPress (I am).

I want to add some HTML (a <script> tag, actually) to the page where you edit a post. I do NOT want to add HTML code to the post itself, rather I want to add some stuff somewhere in the code around the editor.

I think what I need is to hook into some action that fires when the editor page is created, but I’m not sure.

(I am guessing this is probably not a good practice but I’m trying to do a quick and dirty hack to save myself a lot of time in a project that is not going to be reused in the future. I want to use javascript to modify the editor page slightly when the DOM ready event fires.)

Also, can I do it from my theme’s functions.php file, or does it have to be a plugin?

Any help much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:00:24+00:00Added an answer on June 2, 2026 at 11:00 pm

    Here is a simple function which you can put in you functions.php file and add your script code, and it will only show up on the new/edit post page:

    add_action('admin_footer','add_my_script');
    function add_my_script() {
        global $pagenow;
        if (in_array( $pagenow, array( 'post.php', 'post-new.php' ) )){
            ?>
            <SCRIPT TYPE="text/javascript">
                //your script here
            </SCRIPT>
            <?php
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is easy in .NET (not my question) but I'm trying to figure out
I would imagine that this would be an easy question for someone who works
The idea it's very easy, i have an http download class, this class must
This must be a stupid question, but nevertheless I find it curious: Say I
This must be a dumb question, but I don't see any obvious references. How
This must be a FAQ, but I can’t find a duplicate question! There are
This must be a dumb question, but I cannot figure it out. I also
First, I know this is kind of common question, but I could not find
An easy question to ask hope not stupid. I am doing a Search engine
I hope this question has an obvious answer to anyone who knows his way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.