{"id":5708,"date":"2020-03-24T15:00:19","date_gmt":"2020-03-24T14:00:19","guid":{"rendered":"https:\/\/qodeinteractive.com\/magazine\/?p=5708"},"modified":"2020-10-15T10:21:54","modified_gmt":"2020-10-15T08:21:54","slug":"add-custom-javascript-to-wordpress","status":"publish","type":"post","link":"https:\/\/qodeinteractive.com\/magazine\/add-custom-javascript-to-wordpress\/","title":{"rendered":"How to Add Custom JavaScript to Your WordPress Website"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row][vc_column][vc_column_text]JavaScript code can be added to your WordPress website for various purposes, usually to improve a feature or add functionality. Regardless of the reason you\u2019re adding JavaScript (JS) to your website, it is important to properly create, place and keep up this code. Incorrect code placement can hurt the site\u2019s performance or even break it. [\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]In this article, we will show you several ways to add the JavaScript code. Let\u2019s begin![\/vc_column_text][vc_empty_space height=&#8221;68px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">How To Add JavaScript To WordPress &#8211; Theme Options<\/h2>\n<p>[\/vc_column_text][vc_column_text]Some WordPress themes incorporate a field for including JS code. To see if that\u2019s the case with your website theme, review its available options. If the option exists, insert the JS code in the designated place, if it exists.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]For example, all WordPress themes created by <a href=\"https:\/\/qodeinteractive.com\/\">Qode Interactive<\/a> allow you to insert JS code in the theme settings. You can access them by navigating to Theme_name Options &gt; General. Scroll down to the section called Custom Code and insert your JS code in the Custom JS field.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Theme-Options.jpg\" class=\"attachment-full size-full\" alt=\"Theme Options\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Theme-Options.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Theme-Options-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Theme-Options-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;79px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">Using Plugins<\/h2>\n<p>[\/vc_column_text][vc_column_text]One of the many benefits of WordPress is a wide array of available plugins for just about any functionality you can think of. Therefore, adding JS code to your WordPress site can be as simple as finding the plugin that best suits your needs.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]JavaScript plugins can be free, premium, or even come bundled with the themes. In this article, we will cover several examples of these plugins, but if they don\u2019t seem like the right fit, you are free to explore beyond this list.[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Plugin Shortcodes<\/h3>\n<p>[\/vc_column_text][vc_column_text]Some plugins, like WPBakery Page Builder, have shortcodes for adding JS to individual pages and posts. In WPBakery, this shortcode is called Raw JS.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]If you don\u2019t have this plugin, first you have to install it and activate it. Then, go to the backend of a page or a post, and click on \u201cAdd Element\u201d.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Add-Element.jpg\" class=\"attachment-full size-full\" alt=\"Add Element\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Add-Element.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Add-Element-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Add-Element-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Search for \u201cRaw JS\u201d and click to add the shortcode.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode.jpg\" class=\"attachment-full size-full\" alt=\"Raw JS shortcode\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]The only thing left to do is add the code within the shortcode. By creating the shortcode, you also create a dummy JS code. Add your code between the opening <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;script&gt;<\/code> tag and closing <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;\/script&gt;<\/code> tag.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]If you delete the dummy JS code, you have to make sure that the code you insert has both the opening <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;script&gt;<\/code> and the closing <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;\/script&gt;<\/code> tag.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode-1.jpg\" class=\"attachment-full size-full\" alt=\"Raw JS Shortcode\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode-1.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode-1-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode-1-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;60px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode-2.jpg\" class=\"attachment-full size-full\" alt=\"Raw JS Shortcode\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode-2.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode-2-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Raw-JS-shortcode-2-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]If you are using this method to add JavaScript to your website, it is strongly recommended that you add JS code that is smaller in size. Otherwise, the page loading speed could decrease. If you want to include larger JS code, consider using a different method.[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">How To Add JavaScript To WordPress &#8211; Plugin Options<\/h3>\n<p>[\/vc_column_text][vc_column_text]Most plugins offer options for including JS code. Depending on the plugin, this code can be applied site-wide, or be page-specific. In this section, we will describe the <a href=\"https:\/\/wordpress.org\/plugins\/insert-headers-and-footers\/\" target=\"_blank\" rel=\"noopener noreferrer\">Insert Headers and Footers plugin<\/a>, as it is a widely recommended solution.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]This plugin is used to implement site-wide JS code, although the code can be adjusted for specific pages or posts only. For the purposes of this guide, we will focus on the site-wide code, since the intricacies of additional code adjustments warrant a separate article. [\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]One example of popular site-wide code is the Google Analytics code. To install the plugin, navigate to Plugins, click on \u201cAdd New\u201d and type a keyword (\u201cHeaders\u201d, for example) in the search bar. Click on the result, install it, and don\u2019t forget to activate it &#8211; the installed plugin won\u2019t work unless it is activated.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-Plugin.jpg\" class=\"attachment-full size-full\" alt=\"Headers and Footers Plugin\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-Plugin.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-Plugin-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-Plugin-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]To use the plugin, go to Settings, click on Headers and Footers, and insert your code either in the Scripts in the Header or Scripts in the Footer section.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-Options.jpg\" class=\"attachment-full size-full\" alt=\"Headers and Footers Options\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-Options.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-Options-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-Options-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;60px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-options-2.jpg\" class=\"attachment-full size-full\" alt=\"Headers and Footers Options\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-options-2.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-options-2-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Headers-and-Footers-options-2-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Here\u2019s another tip: inside the Scripts in the Header field, include the code that is a part of the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;head&gt;<\/code> section and applied site-wide. This includes Google Analytics code, stylesheets or code concerning <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;meta&gt;<\/code> tags, for example. The rest should be placed in the \u201cScripts in Footer\u201d section, especially if the JS code is adjusted to be page-specific.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]However, if the code isn\u2019t working when you add it to the first section, try to remove it and add it to the second section.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Another way to add JS code is to add it directly to the appropriate section.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Adding-Scripts.jpg\" class=\"attachment-full size-full\" alt=\"Adding Scripts\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Adding-Scripts.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Adding-Scripts-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Adding-Scripts-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]If you have larger JS scripts, you can create a stylesheet (a file with a .js extension), upload it to the dedicated JS folder inside your theme and include its path. The path will most likely be one of the following two:[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]wp-content\/themes\/theme_name\/js[\/vc_column_text][vc_column_text]Or[\/vc_column_text][vc_column_text]wp-content\/themes\/theme_name\/assets\/js [\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Add the line of code with the path to the uploaded file. Depending on the path, the src attribute will vary. Here are two possible examples: [\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;script src=\"your_website_url\/wp-content\/themes\/theme_name&gt;\/js\/filename.js\"&gt;&lt;\/script&gt;<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;18px&#8221;][vc_column_text]Or[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;script src=\"your_website_url\/wp-content\/themes\/theme_name&gt;\/assets\/js\/filename.js\"&gt;&lt;\/script&gt;<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;18px&#8221;][vc_column_text]When you use this line, the entire code from the uploaded file will be loaded when the script is run.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Adding-scripts-2.jpg\" class=\"attachment-full size-full\" alt=\"Adding Scripts\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Adding-scripts-2.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Adding-scripts-2-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Adding-scripts-2-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Make sure the code you add has both the opening <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;script&gt;<\/code> and the closing <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;\/script&gt;<\/code> tag.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Always check your site thoroughly after adding the JS code. Although JavaScript code can improve the functionality of certain pages, it can harm others by overlooking the outlying cases.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]If you don\u2019t think this plugin is the right fit for you, we encourage you to explore the <a href=\"https:\/\/wordpress.org\/plugins\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress.org plugins page<\/a> or tell us about your experiences with JS inclusion plugins in the comments.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Now let\u2019s move onto more coding-focused solutions. These will require a somewhat deeper understanding of WordPress, so they are a good choice for developers. If you want to give them a try despite not being WordPress savvy, try doing some additional research to prepare. [\/vc_column_text][vc_empty_space height=&#8221;81px&#8221;][vc_separator color=&#8221;custom&#8221; accent_color=&#8221;#f0f0f0&#8243;][vc_empty_space height=&#8221;50px&#8221;][vc_widget_sidebar sidebar_id=&#8221;top-picks-banner&#8221;][vc_empty_space height=&#8221;28px&#8221;][vc_separator color=&#8221;custom&#8221; accent_color=&#8221;#f0f0f0&#8243;][vc_empty_space height=&#8221;80px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">More Advanced Methods<\/h2>\n<p>[\/vc_column_text][vc_column_text]Before we show you coding solutions for JavaScript, we will address some bad coding practices and habits you should avoid. [\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]One bad practice you should avoid at all costs is directly adding JS code inside your theme\u2019s header.php and footer.php files. This also extends to the file path inclusion of a certain uploaded JS file, both inside header.php, and footer.php.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Why is this such a bad idea? Whenever your theme is updated, your code will be lost during the all-encompassing override of the theme files. There are ways to avoid this by copying header.php and footer.php files inside a child theme. [\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]However, it can still lead to conflicts with the plugin-loaded JS scripts, which is precisely why this method is not recommended. Now let\u2019s look into the right ways to add JavaScript to your WordPress website.[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Using wp_head and wp_footer Hooks<\/h3>\n<p>[\/vc_column_text][vc_column_text]A method that is less encouraged, but still better than directly including the code, is adding the code using the wp_head and wp_footer <a href=\"https:\/\/developer.wordpress.org\/plugins\/hooks\/\" target=\"_blank\" rel=\"noopener noreferrer\">hooks<\/a>. Hooks are a way of changing the default behavior of themes, plugins, and WordPress, without changing its template files.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]You can add the code both inside the theme and plugins, created specifically for your site. We recommend you use the functions.php of your child theme, so you can preserve the changes after theme updates. Another suggestion &#8211; add smaller JS code scripts. [\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Why is this method not encouraged? While it may seem effective at first, adding too much code can easily become hard to keep up with. Furthermore, it can cause certain scripts to load multiple times, decreasing the speed of your website. So, this method will serve you well only with careful and limited use. [\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]If you are sure you want to add JavaScript this way, simply insert one of these 2 blocks of code inside your functions.php (or functions.php of your child theme), depending on whether you want to hook onto wp_head or wp_footer.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">function my_javascript_code() {\r\n?&gt;\r\n&lt;script&gt;\r\n\/\/ your javascript code goes here\r\n&lt;\/script&gt;\r\n&lt;?php\r\n}\r\nadd_action('wp_head', 'my_javascript_code');<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;39px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Javascript-hooks-code.jpg\" class=\"attachment-full size-full\" alt=\"Javascript Hooks Code\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Javascript-hooks-code.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Javascript-hooks-code-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Javascript-hooks-code-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;60px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">function my_footer_javascript_code() {\r\n?&gt;\r\n&lt;script&gt;\r\n\/\/ your javascript code goes here\r\n&lt;\/script&gt;\r\n&lt;?php\r\n}\r\nadd_action('wp_footer', 'my_footer_javascript_code');<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;39px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Javascript-Hooks-Code-WP-Footer.jpg\" class=\"attachment-full size-full\" alt=\"Javascript Hooks Code WP Footer\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Javascript-Hooks-Code-WP-Footer.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Javascript-Hooks-Code-WP-Footer-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Javascript-Hooks-Code-WP-Footer-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]It is also possible to apply the JS code selectively, using <a href=\"https:\/\/codex.wordpress.org\/Conditional_Tags\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress conditional tags<\/a>.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]We will include two possible examples:[\/vc_column_text][vc_empty_space height=&#8221;23px&#8221;]<ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">page-specific code, for a page called \u201cAbout Us\u201d and<\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;14px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">function about_us_javascript_code() {\r\nif ( is_page( 'About Us' ) ) { ?&gt;\r\n&lt;script&gt;\r\n\/\/ your javascript code goes here\r\n&lt;\/script&gt;\r\n&lt;?php }\r\n}\r\nadd_action( 'wp_head', 'about_us_javascript_code' );<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;39px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_head_code-1.jpg\" class=\"attachment-full size-full\" alt=\"Wp Head Code\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_head_code-1.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_head_code-1-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_head_code-1-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;23px&#8221;]<ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">post-specific code, for the post with the ID of 30.<\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;14px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">function my_post_javascript_code() {\r\nif ( is_single( '30' ) ) { ?&gt;\r\n&lt;script&gt;\r\n\/\/ your javascript code goes here\r\n&lt;\/script&gt;\r\n&lt;?php }\r\n}\r\nadd_action( 'wp_head', 'my_post_javascript_code' );<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;39px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_head_code-2.jpg\" class=\"attachment-full size-full\" alt=\"Wp Head Code\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_head_code-2.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_head_code-2-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_head_code-2-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]The ID\u2019s of the posts are visible when you\u2019re editing. The ID number is located within the URL after the \u201cpost=\u201d part.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Post-ID.jpg\" class=\"attachment-full size-full\" alt=\"Post ID\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Post-ID.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Post-ID-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Post-ID-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Needless to say, it is important to take care of the proper code syntax in the opening and closing tags, both for PHP and JavaScript. [\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Similar codes can be created and \u201chooked onto\u201d wp_footer hook. Wp_head hook is located before the closing of the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;\/head&gt;<\/code> tag, while the wp_footer is located before the closing of the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;\/body&gt;<\/code> tag. We recommend that you hook the code onto the wp_footer hook to avoid decreased loading speeds of your website, especially if the code is larger in length.[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Using wp_enqueue_script<\/h3>\n<p>[\/vc_column_text][vc_column_text]The most effective method of adding JavaScript code to your WordPress site is creating a separate .js file, inserting it in the proper place and then using the <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_enqueue_script\/\" target=\"_blank\" rel=\"noopener noreferrer\">wp_enqueue_script<\/a> function.<br \/>\nMore precisely, this means you\u2019ll add wp_enqueue_script to another function that is hooked to one of the two WordPress script loading hooks &#8211; wp_enqueue_scripts.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]This method is preferred by developers of any well-coded theme. It bypasses the downsides of the previously described methods, such as plugin conflicts and loading the same script multiple times. Also, WordPress offers a <a href=\"https:\/\/developer.wordpress.org\/themes\/basics\/including-css-javascript\/#default-scripts-included-and-registered-by-wordpress\" target=\"_blank\" rel=\"noopener noreferrer\">list of registered, widely used scripts<\/a>, in order to improve this process even further.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Similarly to the method we described in the previous section, this method requires the following: [\/vc_column_text][vc_empty_space height=&#8221;23px&#8221;]<ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">Creating a file with the .js extension <\/span>        <\/div>\n            <\/li>\n<\/ul><ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">Placing the file in the designated place within the theme or plugin<\/span>        <\/div>\n            <\/li>\n<\/ul><ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">Proper use of the wp_enqueue_script function<\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_column_text]We will clarify things by explaining some of the possible uses of this function.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]As noted in the description, the wp_enqueue_script function has 5 parameters. Out of these five parameters, only the first one is required. That is the unique handle name.[\/vc_column_text][vc_empty_space height=&#8221;23px&#8221;]<ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">The code you can see below enqueues a script with the handle \u201cdev-script\u201d. The path to the file is wp-content\/themes\/theme_name\/js\/devscript.js. <\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;10px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Devscript-image.jpg\" class=\"attachment-full size-full\" alt=\"Devscript Image\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Devscript-image.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Devscript-image-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Devscript-image-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]The remaining parameters are set to default values. This means the function has no dependent scripts, its version is the same as the currently installed WordPress version, and it is enqueued before the closing of the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;\/head&gt;<\/code> tag.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]The code should be placed inside the functions.php file of your (parent) theme.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Devscript-functions.jpg\" class=\"attachment-full size-full\" alt=\"Devscript Functions\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Devscript-functions.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Devscript-functions-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Devscript-functions-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;60px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">function my_dev_script() {\r\nwp_enqueue_script( 'dev-script', get_template_directory_uri() . '\/js\/devscript.js');\r\n}\r\nadd_action('wp_enqueue_scripts', 'my_dev_script');<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;14px&#8221;]<ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">Script enqueued bellow has the handle \u201cappear\u201d, while the path to the file is wp-content\/themes\/child_theme_name\/assets\/js\/ jquery.appear.js. The function is dependent on the script with the handle \u201cjquery\u201d. Its version is the same as the currently installed WordPress version and it is enqueued before the closing tag.<\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_column_text]The code should be placed inside the functions.php file of your child theme.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">function js_appear_script{\r\nwp_enqueue_script( 'appear', get_stylesheet_directory_uri() . '\/assets \/js\/ jquery.appear.js', array( 'jquery' ), false, true );\r\n}\r\nadd_action('wp_enqueue_scripts','js_appear_script');<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;14px&#8221;]<ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">Script handle is \u201cvery-compatible\u201d, path to the file is wp-content\/plugins\/plugin_name\/&#8217;assets\/js\/compatible.js. The function has no dependent scripts, its version is 3.5 and it is enqueued before the closing &lt;\/body&gt; tag.<\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_column_text]The code should be placed in one of the files of your plugin. The same plugin where you previously inserted the .js file.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">function my_compatible_script() {\r\nwp_enqueue_script('very-compatible', plugins_url('assets\/js\/compatible.js', __FILE__), array(), '3.5', true);\r\n}\r\nadd_action('wp_enqueue_scripts','my_compatible_script');<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;14px&#8221;]<ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">The code below first registers the script with wp_register_script function and then enqueues.<\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_column_text]The wp_register_script function has the same parameters as the wp_enqueue_script, so it doesn\u2019t require additional explanation. Given all the parameters, the wp_enqueue_script function already registers the JS script, which is why using the wp_register_script is not necessary.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]However, the main benefit of using both functions is that the same script can be de-registered using <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_deregister_script\/\" target=\"_blank\" rel=\"noopener noreferrer\">wp_deregister_script<\/a>, and then re-registered with the same handle and different remaining parameters.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">function register_and_add_script() {\r\nwp_register_script('my-js-script', get_template_directory_uri() . '\/assets\/js\/my_js_script.js', array('jquery'),'3.4.1', true);\r\nwp_enqueue_script('my-js-script');\r\n}\r\nadd_action( 'wp_enqueue_scripts', 'register_and_add_script' );<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;64px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Using wp_add_inline_script<\/h3>\n<p>[\/vc_column_text][vc_column_text]This method of adding JS code is best used in conjunction with the previously described method. While using wp_enqueue_script is better suited for adding large scripts, the wp_add_inline_script is the best choice for smaller JS code inclusions.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_add_inline_script\/\" target=\"_blank\" rel=\"noopener noreferrer\">Wp_add_inline_script<\/a> function adds the JS code to an already registered script, either at the beginning or at the end. Therefore, the steps are as follows:[\/vc_column_text][vc_empty_space height=&#8221;23px&#8221;]<ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">Using wp_enqueue_script<\/span>        <\/div>\n            <\/li>\n<\/ul><ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">Placing the file in the designated folder<\/span>        <\/div>\n            <\/li>\n<\/ul><ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">Creating the .js file <\/span>        <\/div>\n            <\/li>\n<\/ul><ul class=\"qodef-unordered-list-item \">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">Using wp_add_inline_script <\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_column_text]Both of the functions should be used within a function that \u201chooks\u201d on to wp_enqueue_scripts.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Here\u2019s one example of this type of function. It should be placed inside the functions.php of the (parent) theme.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">function inline_custom_js() {\r\nwp_enqueue_script( 'theme-js-script', get_template_directory_uri() . '\/js\/modules.js', array( 'jquery' ), false, true );\r\n$custom_js = 'insert-your-inline-javascript-here';\r\nif ( ! empty( $custom_js ) ) {\r\nwp_add_inline_script( 'theme-js-script', $custom_js );\r\n}\r\n}\r\nadd_action( 'wp_enqueue_scripts', 'inline_custom_js' );<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;39px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_inline_script.jpg\" class=\"attachment-full size-full\" alt=\"\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_inline_script.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_inline_script-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp_inline_script-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;79px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">Final Thoughts<\/h2>\n<p>[\/vc_column_text][vc_column_text]In this guide on JavaScript code inclusion in WordPress, we tried to cover all the levels of difficulty and efficiency. We\u2019ve also given you an opportunity to weigh the pros and cons of each method.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Depending on your needs and knowledge, you can find the method that suits you the best. You can also use this tutorial to learn something new and get to know your WordPress website a little bit better.[\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>In this article, we will show you how to add the JavaScript code to your website using theme options, plugins, and advanced coding methods. <\/p>\n","protected":false},"author":11229,"featured_media":5963,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[14,15,4,13],"class_list":["post-5708","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-core","tag-plugins","tag-tips","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/5708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/users\/11229"}],"replies":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/comments?post=5708"}],"version-history":[{"count":0,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/5708\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media\/5963"}],"wp:attachment":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media?parent=5708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/categories?post=5708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/tags?post=5708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}