{"id":712,"date":"2016-07-13T14:12:49","date_gmt":"2016-07-13T02:12:49","guid":{"rendered":"http:\/\/geektactics.geektamin.com\/?p=712"},"modified":"2024-06-14T09:52:54","modified_gmt":"2024-06-13T21:52:54","slug":"stop-tags-removed-gravity-forms-html-fields","status":"publish","type":"post","link":"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/","title":{"rendered":"How to stop script tags being removed from Gravity Forms HTML fields"},"content":{"rendered":"

If you are trying to insert a piece of Javascript code in Gravity Forms HTML fields but the script tag gets removed when you update your form, then this tutorials will help you fix this problem by just adding a few line of code to your functions.php file.<\/p>\n

Why the script tag gets removed<\/h2>\n

By default\u00a0WordPress\u2019s TinyMCE Editor will remove the <script> tags. But you can overwrite the default settings by just adding the below code to your functions.php file.<\/p>\n

\r\nfunction allow_script_tags( $allowedposttags ){\r\n    $allowedposttags['script'] = array(\r\n        'type' => true,\r\n        'src' => true,\r\n        'height' => true,\r\n        'width' => true,\r\n    );   \r\n    return $allowedposttags;\r\n}\r\nadd_filter('wp_kses_allowed_html','allow_script_tags', 1);\r\n <\/code><\/pre>\n

Paste the above code to your functions.php and updated your page. \u00a0Now go to Gravity Form, you should be able to insert Javascript code and the <script> tags will not get removed when you update your form.<\/p>\n

Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"

If you are trying to insert a piece of Javascript code in Gravity Forms HTML fields but the script tag gets removed when you update your form, then this tutorials will help you fix this problem by just adding a few line of code to your functions.php file. Why the script tag gets removed By […]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[149],"class_list":["post-712","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-gravity-forms"],"yoast_head":"\nHow to stop script tags being removed from Gravity Forms HTML fields - Geektactics<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to stop script tags being removed from Gravity Forms HTML fields - Geektactics\" \/>\n<meta property=\"og:description\" content=\"If you are trying to insert a piece of Javascript code in Gravity Forms HTML fields but the script tag gets removed when you update your form, then this tutorials will help you fix this problem by just adding a few line of code to your functions.php file. Why the script tag gets removed By […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/\" \/>\n<meta property=\"og:site_name\" content=\"Geektactics\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-13T02:12:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-13T21:52:54+00:00\" \/>\n<meta name=\"author\" content=\"Josh Moore\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Josh Moore\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/\"},\"author\":{\"name\":\"Josh Moore\",\"@id\":\"https:\/\/geektactics.co.nz\/#\/schema\/person\/6bb496f93975e50731c7b169c39bc4ab\"},\"headline\":\"How to stop script tags being removed from Gravity Forms HTML fields\",\"datePublished\":\"2016-07-13T02:12:49+00:00\",\"dateModified\":\"2024-06-13T21:52:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/\"},\"wordCount\":139,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/geektactics.co.nz\/#organization\"},\"keywords\":[\"Gravity Forms\"],\"articleSection\":[\"Wordpress\"],\"inLanguage\":\"en-NZ\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/\",\"url\":\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/\",\"name\":\"How to stop script tags being removed from Gravity Forms HTML fields - Geektactics\",\"isPartOf\":{\"@id\":\"https:\/\/geektactics.co.nz\/#website\"},\"datePublished\":\"2016-07-13T02:12:49+00:00\",\"dateModified\":\"2024-06-13T21:52:54+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/#breadcrumb\"},\"inLanguage\":\"en-NZ\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/geektactics.co.nz\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to stop script tags being removed from Gravity Forms HTML fields\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/geektactics.co.nz\/#website\",\"url\":\"https:\/\/geektactics.co.nz\/\",\"name\":\"Geektactics\",\"description\":\"Interesting Stuff for Geeks\",\"publisher\":{\"@id\":\"https:\/\/geektactics.co.nz\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/geektactics.co.nz\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-NZ\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/geektactics.co.nz\/#organization\",\"name\":\"Geektactics\",\"url\":\"https:\/\/geektactics.co.nz\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-NZ\",\"@id\":\"https:\/\/geektactics.co.nz\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/geektactics.co.nz\/wp-content\/uploads\/sites\/2\/2024\/06\/geektactics-logo.png\",\"contentUrl\":\"https:\/\/geektactics.co.nz\/wp-content\/uploads\/sites\/2\/2024\/06\/geektactics-logo.png\",\"width\":2001,\"height\":831,\"caption\":\"Geektactics\"},\"image\":{\"@id\":\"https:\/\/geektactics.co.nz\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/geektactics.co.nz\/#\/schema\/person\/6bb496f93975e50731c7b169c39bc4ab\",\"name\":\"Josh Moore\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-NZ\",\"@id\":\"https:\/\/geektactics.co.nz\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2bea43488633fc79ace340300f8ab6d6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2bea43488633fc79ace340300f8ab6d6?s=96&d=mm&r=g\",\"caption\":\"Josh Moore\"},\"description\":\"I love marketing and technology. I run Duoplus Online Marketing and enjoy helping companies grow their income especially through using online marketing effectively.\",\"sameAs\":[\"https:\/\/www.duoplus.nz\"],\"url\":\"https:\/\/geektactics.co.nz\/blog\/author\/josh\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to stop script tags being removed from Gravity Forms HTML fields - Geektactics","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/","og_locale":"en_US","og_type":"article","og_title":"How to stop script tags being removed from Gravity Forms HTML fields - Geektactics","og_description":"If you are trying to insert a piece of Javascript code in Gravity Forms HTML fields but the script tag gets removed when you update your form, then this tutorials will help you fix this problem by just adding a few line of code to your functions.php file. Why the script tag gets removed By […]","og_url":"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/","og_site_name":"Geektactics","article_published_time":"2016-07-13T02:12:49+00:00","article_modified_time":"2024-06-13T21:52:54+00:00","author":"Josh Moore","twitter_misc":{"Written by":"Josh Moore","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/#article","isPartOf":{"@id":"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/"},"author":{"name":"Josh Moore","@id":"https:\/\/geektactics.co.nz\/#\/schema\/person\/6bb496f93975e50731c7b169c39bc4ab"},"headline":"How to stop script tags being removed from Gravity Forms HTML fields","datePublished":"2016-07-13T02:12:49+00:00","dateModified":"2024-06-13T21:52:54+00:00","mainEntityOfPage":{"@id":"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/"},"wordCount":139,"commentCount":0,"publisher":{"@id":"https:\/\/geektactics.co.nz\/#organization"},"keywords":["Gravity Forms"],"articleSection":["Wordpress"],"inLanguage":"en-NZ","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/","url":"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/","name":"How to stop script tags being removed from Gravity Forms HTML fields - Geektactics","isPartOf":{"@id":"https:\/\/geektactics.co.nz\/#website"},"datePublished":"2016-07-13T02:12:49+00:00","dateModified":"2024-06-13T21:52:54+00:00","breadcrumb":{"@id":"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/#breadcrumb"},"inLanguage":"en-NZ","potentialAction":[{"@type":"ReadAction","target":["https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/geektactics.co.nz\/blog\/stop-tags-removed-gravity-forms-html-fields\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/geektactics.co.nz\/"},{"@type":"ListItem","position":2,"name":"How to stop script tags being removed from Gravity Forms HTML fields"}]},{"@type":"WebSite","@id":"https:\/\/geektactics.co.nz\/#website","url":"https:\/\/geektactics.co.nz\/","name":"Geektactics","description":"Interesting Stuff for Geeks","publisher":{"@id":"https:\/\/geektactics.co.nz\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/geektactics.co.nz\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-NZ"},{"@type":"Organization","@id":"https:\/\/geektactics.co.nz\/#organization","name":"Geektactics","url":"https:\/\/geektactics.co.nz\/","logo":{"@type":"ImageObject","inLanguage":"en-NZ","@id":"https:\/\/geektactics.co.nz\/#\/schema\/logo\/image\/","url":"https:\/\/geektactics.co.nz\/wp-content\/uploads\/sites\/2\/2024\/06\/geektactics-logo.png","contentUrl":"https:\/\/geektactics.co.nz\/wp-content\/uploads\/sites\/2\/2024\/06\/geektactics-logo.png","width":2001,"height":831,"caption":"Geektactics"},"image":{"@id":"https:\/\/geektactics.co.nz\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/geektactics.co.nz\/#\/schema\/person\/6bb496f93975e50731c7b169c39bc4ab","name":"Josh Moore","image":{"@type":"ImageObject","inLanguage":"en-NZ","@id":"https:\/\/geektactics.co.nz\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2bea43488633fc79ace340300f8ab6d6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2bea43488633fc79ace340300f8ab6d6?s=96&d=mm&r=g","caption":"Josh Moore"},"description":"I love marketing and technology. I run Duoplus Online Marketing and enjoy helping companies grow their income especially through using online marketing effectively.","sameAs":["https:\/\/www.duoplus.nz"],"url":"https:\/\/geektactics.co.nz\/blog\/author\/josh\/"}]}},"_links":{"self":[{"href":"https:\/\/geektactics.co.nz\/wp-json\/wp\/v2\/posts\/712"}],"collection":[{"href":"https:\/\/geektactics.co.nz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geektactics.co.nz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geektactics.co.nz\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/geektactics.co.nz\/wp-json\/wp\/v2\/comments?post=712"}],"version-history":[{"count":5,"href":"https:\/\/geektactics.co.nz\/wp-json\/wp\/v2\/posts\/712\/revisions"}],"predecessor-version":[{"id":730,"href":"https:\/\/geektactics.co.nz\/wp-json\/wp\/v2\/posts\/712\/revisions\/730"}],"wp:attachment":[{"href":"https:\/\/geektactics.co.nz\/wp-json\/wp\/v2\/media?parent=712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geektactics.co.nz\/wp-json\/wp\/v2\/categories?post=712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geektactics.co.nz\/wp-json\/wp\/v2\/tags?post=712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}