Title: 4.2.3 and embebed Javascript
Last modified: August 30, 2016

---

# 4.2.3 and embebed Javascript

 *  [pabloalmunia](https://wordpress.org/support/users/pabloalmunia/)
 * (@pabloalmunia)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/)
 * The 4.2.3 destroy de Javascript included into pages or post.
 * In some case the code is trucated.
 * In other case the code is change, for example:
 *     ```
       sURLVariables[1];
       ```
   
 * is now
 *     ```
       sURLVariables&#091 i&#093
       ```
   
 * (Sorry, after &#091 and &#093 is included a ;, but this html editor change the
   code to [ and ]).
 * The problem is very hard and we don’t have a solution or workaround.

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/423-and-embebed-javascript/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/423-and-embebed-javascript/page/2/?output_format=md)

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6360989)
 * Can you link to a page with the issue?
 *  Thread Starter [pabloalmunia](https://wordpress.org/support/users/pabloalmunia/)
 * (@pabloalmunia)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361091)
 * Yes:
 * [http://www.itmplatform.com/es/programs-and-portfolio-software-de-gestion-de-portafolio-de-proyectos-pmp/](http://www.itmplatform.com/es/programs-and-portfolio-software-de-gestion-de-portafolio-de-proyectos-pmp/)
 * Kind regards
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361092)
 * Can you unminify your code so that you can debug it easier?
 *  Thread Starter [pabloalmunia](https://wordpress.org/support/users/pabloalmunia/)
 * (@pabloalmunia)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361093)
 * done.
 * Search:
 *     ```
       <script type="text/javascript">/* <!&#091
       ```
   
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361094)
 * This code is found inside the page/ post ‘Text’ editor? Have you considered separating
   out using a Custom JS plugin instead?
 *  Thread Starter [pabloalmunia](https://wordpress.org/support/users/pabloalmunia/)
 * (@pabloalmunia)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361095)
 * I do believe the problem is this new function on 4.2.3 version of WordPress:
 *     ```
       /**
       	 * Replace characters or phrases within HTML elements only.
       	 *
       	 * @since 4.2.3
       	 *
       	 * @param string $haystack The text which has to be formatted.
       	 * @param array $replace_pairs In the form array('from' => 'to', ...).
       	 * @return string The formatted text.
       	 */
       	function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
       ```
   
 * Our code work fine in previous version of wordpress and the automatic upgrade
   broke our function.
 * Of course, we can change our pages and change the code for a custom plugin and
   a custom shortcode, but you have a error in your code.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361096)
 * I always thought the ‘Text’ editor should only contain code that the ‘Visual’
   editor can contain. So, that excludes JavaScript. It seems you were using a hacky
   way to get the JS in there in the first place:
 *     ```
       <!--
       ```
   
 *  Thread Starter [pabloalmunia](https://wordpress.org/support/users/pabloalmunia/)
 * (@pabloalmunia)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361097)
 * It’s very usual include javascript into page and post of WordPress before 4.2.3.
   If you have your criteria it is a new.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361099)
 * The recommended techniques have always been to enqueue JavaScript using your 
   Child Theme functions.php file: [https://codex.wordpress.org/Using_Javascript](https://codex.wordpress.org/Using_Javascript)
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361100)
 * For posts, it says only call the function name in your Text editor. Don’t write
   JS code there: [https://codex.wordpress.org/Using_Javascript#JavaScript_in_Posts](https://codex.wordpress.org/Using_Javascript#JavaScript_in_Posts)
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361101)
 * Use a plugin if you don’t want to enqueue things [https://wordpress.org/plugins/tc-custom-javascript/](https://wordpress.org/plugins/tc-custom-javascript/)
 *  Thread Starter [pabloalmunia](https://wordpress.org/support/users/pabloalmunia/)
 * (@pabloalmunia)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361102)
 * We are move the code to a external javascript and work fine as:
 *     ```
       <script src="/lib/themes/DiviChild/partnerLogo.js"></script>
       ```
   
 * Thanks
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361103)
 * I see your problem, maybe the Codex needs to be updated. I asked to discuss with
   the Codex community if the “JavaScript in Posts” article is still relevant.
 * Not sure if this works for you; [https://codex.wordpress.org/Talk:Using_Javascript](https://codex.wordpress.org/Talk:Using_Javascript)
 *  [petermjames](https://wordpress.org/support/users/petermjames/)
 * (@petermjames)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361121)
 * I’ve found an easy solution and posted it in another thread – [https://wordpress.org/support/topic/no-javascript-redirects-after-wordpress-423?replies=4](https://wordpress.org/support/topic/no-javascript-redirects-after-wordpress-423?replies=4).
 * However, what we are doing is slightly dirty so it is probably better to enqueue
   or use a plugin.
 *  Thread Starter [pabloalmunia](https://wordpress.org/support/users/pabloalmunia/)
 * (@pabloalmunia)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/#post-6361122)
 * THis solution don’t work in my cases because some javascript characters are transformet
   as [, ], etc.
 * Thks

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/423-and-embebed-javascript/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/423-and-embebed-javascript/page/2/?output_format=md)

The topic ‘4.2.3 and embebed Javascript’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 17 replies
 * 4 participants
 * Last reply from: [petermjames](https://wordpress.org/support/users/petermjames/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/423-and-embebed-javascript/page/2/#post-6361129)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
