Adding JavaScript to WordPress Posts Without a Plugin

Sometimes you may want to include some javascript into your post, but you are screwed up with the Syntax Error as shown in Figure 1.1

Figure 1.1 Figure 1.1

Then you start searching for “JavaScript in WordPress Posts” or so, but you can embed javascript into your wordpress posts without any plugin. Just follow these steps :

  • Create a directory on your server for JavaScript. For example,
  • Copy all the code inside the <script> tags and paste it into a js file, say onlynumeric.js
  • Put onlynumeric.js file into your js/ directory on your server, so it is accessible on the web like
  • Now write the following code in your wordpress post :
<script src="" type="text/javascript"></script>

No comments yet.

Leave a Reply