How To Insert JavaScript into WordPress Posts or Pages What we should know is that the CMS is basically differentiating between design and content. The administrator should be the one that inserts JavaScript so it should come as no surprise to notice that inserting JavaScript through the editor is something that is difficult to do. Thankfully, there are different ways in which you could achieve this. We will highlight those that are the most useful.

Étiquette: CMS, JavaScript WordPress, WordPress Posts, WordPress Pages, Scripts n Styles, Script Tags Filtering

Gratuit iPage hébergement Web pour la première année MOMENT

Si vous êtes toujours à la recherche d'un fournisseur d'hébergement Web fiable avec des tarifs abordables, pourquoi vous ne prenez pas un peu de temps pour essayer iPage, seulement avec $1.89/month, inclus $500+ Crédits supplémentaires gratuites pour le paiement de 24 mois ($45)?

Plus de 1.000.000 de clients + existisng peuvent pas avoir tort, vraiment vous n'êtes pas aussi! Plus important encore, lorsque vous enregistrez l'hébergement web à iPage grâce à notre lien, nous allons être heureux de renvoyer un plein remboursement. C'est génial! Vous devriez essayer iPage hébergement web GRATUITEMENT maintenant! Et contactez-nous pour tout ce que vous devez savoir sur iPage.
Essayez iPage GRATUIT première année MOMENT

When you use the WordPress editor the text will be auto-formatted. This automatically restricts inserted script tags. People that want to insert JavaScript code into pages or posts will find this process to be quite frustrating. It also raises some WordPress security problems when it is done wrong.

Disabling Script Tags Filtering In WordPress

Only use this if you do trust your skills. Disabling script tags blocking is something that you can do. You will need to modify the wp-config.php file in order to enable the tags. You just have to define Custom_Tags as being TRUE. Then you want to make the necessary modifications for the functions.php page and you are done.

Remember that this is a method that should never be recommended unless you do know what you do. You are basically going to end up with the security feature being disabled for the entire site and you can add JavaScript at all user permission levels. If there are authors that do not know what to do it is better to simply not enable the option.

Using Plugins That Enable JavaScript Includes

image by

This is basically the simplest option that is available for you right now. You have access to so many useful plugins that will allow the management of JavaScript codes right within posts and pages. There are cases when you have to load JavaScript in the tag of a post or page or after content adjacent to the </body> tag.

In some situations you will want to load the script sitewide while in other cases you just want to focus on a post or a page. You can easily test various different plugins that offer the features you are looking for but the one that is by far the most comprehensive is Scripts n Styles. You would use this WordPress plugin in order to add the scripts you desire at a truly global level, for the entire site, or you can simply add at a post or page level.

By using the WordPress plugin recommended you can include the codes wherever you want to. Everything is simple to do but you still need to at least know exactly what the scripts will do. Since WordPress is made out of different scripts in itself, it is normal for some of the manually added scripts to simply not work well. If you want to use JavaScript codes that would modify some functions of the CMS system, it is better to be sure this is done by a professional. It is a lot more important than what you may think at the moment. You do not want to end up with the blogging platform to not work anymore.


Phong Thai Phong Thai is a Web Developer, Web Coder for 19 years with PHP, JavaScript, CSS. He is the creator of - provide thousands of free JavaScript code examples, web development tips and tricks, helpful blogging guides.

Follow him on twitter@js_bank or connect with him on facebook@jsbank if you want. His websites for your knowledge:,,

JavaScript par jour

Google Safe Browsing McAfee SiteAdvisor Norton SafeWeb Dr.Web