Title: Search function is missing with Autoptimize
Last modified: August 31, 2016

---

# Search function is missing with Autoptimize

 *  Resolved [rchrisbishop](https://wordpress.org/support/users/rchrisbishop/)
 * (@rchrisbishop)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/search-function-is-missing-with-autoptimize/)
 * I use Autoptimize, if I turn off javascript optimization the search bar reappears.
 * When I have JS optimization on, the code appears in the source on several lines,
   like so.
 * <script type=”text/javascript”>jQuery(document).ready(function($){
    $(‘#tablepress-
   2’).dataTable({“stripeClasses”:[‘even’,’odd’],”ordering”:false,”paging”:false});});
   </script> <script type=”text/javascript”>(function() { var request, b = document.
   body, c = ‘className’, cs = ‘customize-support’, rcs = new RegExp(‘(^|\\s+)(no-)?’
   +cs+'(\\s+|$)’);
 *  request = true;
 *  b[c] = b[c].replace( rcs, ‘ ‘ );
    b[c] += ( window.postMessage && request ? ‘‘:‘
   no-‘ ) + cs; }());</script>
 * I moved my site to a new host last week, before this I had no conflicts between
   Autoptimize and TablePress.
 * [https://wordpress.org/plugins/tablepress/](https://wordpress.org/plugins/tablepress/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/search-function-is-missing-with-autoptimize/#post-7129764)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * It should not matter that this JS code is split over multiple lines. Instead,
   I assume that there’s either a conflict in the load order or another JS issue
   that prevents the execution of JS on the page entirely.
 * Can you please post a link to the page with the table where this problem happens,
   so that I can take a direct look? Thanks!
 * Regards,
    Tobias
 *  Thread Starter [rchrisbishop](https://wordpress.org/support/users/rchrisbishop/)
 * (@rchrisbishop)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/search-function-is-missing-with-autoptimize/#post-7129771)
 * [http://www.garagehangover.com/garage-45-reproductions/](http://www.garagehangover.com/garage-45-reproductions/)
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/search-function-is-missing-with-autoptimize/#post-7129826)
 * Hi,
 * thanks! From what I can see, the problem is indeed the load order. When you use
   the “View source” feature in your browser, you will see that the minified JavaScript
   is loaded as the very last script, but after those JS calls that require previously
   loaded files.
 * Can you please check if you can change the loading position of the JS file in
   the Autoptimize settings? Specifically, something like a deferred loading should
   be turned off.
 * Regards,
    Tobias
 *  Thread Starter [rchrisbishop](https://wordpress.org/support/users/rchrisbishop/)
 * (@rchrisbishop)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/search-function-is-missing-with-autoptimize/#post-7129827)
 * The only options are to force JavaScript in <head> or aggregate JS in the HTML.
   Or I can exclude certain scripts.
 * Maybe I’ll have to do without the JS optimization.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/search-function-is-missing-with-autoptimize/#post-7129828)
 * Hi,
 * that’s unfortunate. You could probably also exclude the TablePress JS file, which
   is
 *     ```
       /wp-content/plugins/tablepress/js/jquery.datatables.min.js
       ```
   
 * Regards,
    Tobias
 *  [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/search-function-is-missing-with-autoptimize/#post-7129830)
 * hiya guys;
    I’m AO’s developer. JS which is not forced into head is deferred,
   forcing it into head “un-defers” it.
 * additionally you can indeed exclude specific JS from optimization, in this case
   you could try adding `jquery.js,jquery.datatables.min.js` to the JS optimization
   exclusion list.
 * hope this helps,
    frank
 *  Thread Starter [rchrisbishop](https://wordpress.org/support/users/rchrisbishop/)
 * (@rchrisbishop)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/search-function-is-missing-with-autoptimize/#post-7129833)
 * I read that I’m supposed to keep JS out of the head to prevent render-blocking,
   so I’ll exclude those JS.
 * Thank you both for the work on these plugins.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/search-function-is-missing-with-autoptimize/#post-7129838)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * Best wishes,
    Tobias

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Search function is missing with Autoptimize’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/search-function-is-missing-with-autoptimize/#post-7129838)
 * Status: resolved