Title: solution for js minify bug
Last modified: August 20, 2016

---

# solution for js minify bug

 *  [vinx77](https://wordpress.org/support/users/vinx77/)
 * (@vinx77)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/solution-for-js-minify-bug/)
 * Automatic js minify causes trouble as the order of the files is altered. In my
   case jquery was not loaded as the first js.
 * The cause for this error is in extract.php, w3_extract_js(). The function **array_unique()
   sorts the array of files** and causes the dependency-problems.
 * A quick&dirty fix is:
    $files = array_unique($files); ksort($files); $files =
   array_values($files);
 * or better to replace it with something like:
 * foreach ($files as $file) {
    if (!in_array($the_files, $file)) { $the_files[ ]
   = $file; } }
 * I hope this could be in the next version.
 * [http://wordpress.org/extend/plugins/w3-total-cache/](http://wordpress.org/extend/plugins/w3-total-cache/)

The topic ‘solution for js minify bug’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

## Tags

 * [dependency](https://wordpress.org/support/topic-tag/dependency/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [JS Minify](https://wordpress.org/support/topic-tag/js-minify/)

 * 0 replies
 * 1 participant
 * Last reply from: [vinx77](https://wordpress.org/support/users/vinx77/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/solution-for-js-minify-bug/)
 * Status: not resolved