Title: 500 error when inlinecss and js is enabled
Last modified: March 8, 2025

---

# 500 error when inlinecss and js is enabled

 *  Resolved [snippet24](https://wordpress.org/support/users/snippet24/)
 * (@snippet24)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/)
 * Hi, Frank its been a while I hope everything is good, well this issue I think
   I posted about it but long time ago but I have new info / approach : even using
   the filter to disable in a specific template (after it is enabled in global AO
   settings) it is returning the 500 error in the console though the page loads 
   fine. This is the filter and code I’m using
 *     ```wp-block-code
       function disable_autoptimize_inline_on() {    if ( is_page_template( 'single_actividades.php' ) ) {        add_filter( 'autoptimize_html_minify_inline_js_css', '__return_false' );    }}
       ```
   
 * I tried on localhost on my site setup to verify the filter actually worked and
   it did (had some code snippets that if I comment the above function/filter it
   does indeed minify them) and no errors then.
 * So thats what weird is that I was expecting that just by using the filter which
   excludes it from minify those pages (single pages) it would prevent the error
   from happening but it didn’t. And I think this error is important for SEO, while
   having the preference enabled is great for speed.
 * Also what I can do in order to further debug is replicate an activity single 
   page with password in order to prevent it from being included in the loop for
   the live pages, and then modifying the filter to use the ID of the page.
 * Kind Regards
    -  This topic was modified 1 year, 3 months ago by [snippet24](https://wordpress.org/support/users/snippet24/).

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

1 [2](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/page/2/?output_format=md)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18350565)
 * So if I understand correctly, this does work when using the ID of the page, so
   the problem is with how you check the template?
 *  Thread Starter [snippet24](https://wordpress.org/support/users/snippet24/)
 * (@snippet24)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18350723)
 * No, thats not it I’m afraid, I will explain: 1. the last paragraph is only an
   idea for testing debugging without affecting the actual pages in use of the site
   2. the code with the template works; tested in another site 3. so the point is
   even when the filter is active for all the pages that use the template single_actividades.
   php well even there i still get the error 500 for those
    -  This reply was modified 1 year, 3 months ago by [snippet24](https://wordpress.org/support/users/snippet24/).
    -  This reply was modified 1 year, 3 months ago by [snippet24](https://wordpress.org/support/users/snippet24/).
    -  This reply was modified 1 year, 3 months ago by [snippet24](https://wordpress.org/support/users/snippet24/).
    -  This reply was modified 1 year, 3 months ago by [snippet24](https://wordpress.org/support/users/snippet24/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18350732)
 * ah, so you get a server error (HTP 50x), but the HTML does get returned and the
   inline CSS/ JS in that HTML is indeed not minified?
 *  Thread Starter [snippet24](https://wordpress.org/support/users/snippet24/)
 * (@snippet24)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18350750)
 * Yep thats it
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18350772)
 * in that case the problem is likely not (just) the inline JS/ CSS, but also one(
   or more) of the referenced CSS or JS files :-/
 * try if disabling JS optimization or CSS optimization helps, based on that we 
   can add another filter to disable that?
 *  Thread Starter [snippet24](https://wordpress.org/support/users/snippet24/)
 * (@snippet24)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18350857)
 * Thank you, indeed disabling js optimization while using the inline pref enabled
   with the filter prevents the error.
 * I’m not sure how to use the filter autoptimize_filter_js_exclude to use in a 
   specific template, unless there’s another filter?
    -  This reply was modified 1 year, 3 months ago by [snippet24](https://wordpress.org/support/users/snippet24/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18350861)
 * OK so in the code snippet you already have, add a line to echo `true` to the `
   autoptimize_filter_js_noptimize` filter to disable JS optimization on that pages
   that use that template.
 *  Thread Starter [snippet24](https://wordpress.org/support/users/snippet24/)
 * (@snippet24)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18350863)
 * Like this?
 *     ```wp-block-code
       function disable_autoptimize_inline_on() {    if ( is_page_template( 'single_actividades.php' ) ) {     add_filter( 'autoptimize_html_minify_inline_js_css', '__return_false' );    add_filter( 'autoptimize_filter_js_noptimize', '__return_true' );}}
       ```
   
 * btw in case is useful: exmple page with the error: [https://www.otzerling.com/sesion-de-meditacion-guiada-en-centro-de-educacion-continua-uach/](https://www.otzerling.com/sesion-de-meditacion-guiada-en-centro-de-educacion-continua-uach/)
    -  This reply was modified 1 year, 3 months ago by [snippet24](https://wordpress.org/support/users/snippet24/).
    -  This reply was modified 1 year, 3 months ago by [snippet24](https://wordpress.org/support/users/snippet24/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18350868)
 * indeed, that should disable JS optimization for that template.
 *  Thread Starter [snippet24](https://wordpress.org/support/users/snippet24/)
 * (@snippet24)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18351243)
 * Thank you, I confirm is working, the error in the console.log is gone 🙂
 * Question: how should be further debugged?
    -  This reply was modified 1 year, 3 months ago by [snippet24](https://wordpress.org/support/users/snippet24/).
    -  This reply was modified 1 year, 3 months ago by [snippet24](https://wordpress.org/support/users/snippet24/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18351283)
 * so what error is logged in the PHP errorlog when optimize JS is active on those
   pages?
 *  Thread Starter [snippet24](https://wordpress.org/support/users/snippet24/)
 * (@snippet24)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18351287)
 * here it is: [https://drive.google.com/file/d/1MUau6JpSQ4Gf_RVyzufN712ZZvGKJmVL/view?usp=sharing](https://drive.google.com/file/d/1MUau6JpSQ4Gf_RVyzufN712ZZvGKJmVL/view?usp=sharing)
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18351292)
 * yeah, but that what you see in the browser, but on your server there should be
   a PHP errorlog file and in there a more detailed error would be logged, maybe
   have a look around in that file for pointers to where the problem occurs?
 *  Thread Starter [snippet24](https://wordpress.org/support/users/snippet24/)
 * (@snippet24)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18351303)
 * Ah sorry I fast read :/ sure here it is:
 *     ```wp-block-code
       2025-03-08 18:41:17.106380 [NOTICE] [3454449] [T0] [127.0.0.1:33152#APVH_otzerling.com:443] [STDERR] PHP Fatal error:  Uncaught JSMin_UnterminatedStringException: JSMin: Unterminated String at byte 367: "Hola te invitamos cordialmente a nuestras actividades de Agosto en Avda Amun..tegui 385 en La Serena los d..as s..bados desde las 10 am va a haber un pend..n o banderas budistas  in /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/jsmin.php:212\nStack trace:\n#0 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/jsmin.php(150): JSMin->action()\n#1 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/jsmin.php(84): JSMin->min()\n#2 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/ao-minify-html.php(257): JSMin::minify()\n#3 [internal function]: AO_Minify_HTML->_removeScriptCB()\n#4 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/ao-minify-html.php(108): preg_replace_callback()\n#5 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/ao-minify-html.php(47): AO_Minify_HTML->process()\n#6 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/autoptimizeHTML.php(105): AO_Minify_HTML::minify()\n#7 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/autoptimizeMain.php(592): autoptimizeHTML->minify()\n#8 [internal function]: autoptimizeMain->end_buffering()\n#9 /home/otzerlin/public_html/wp-includes/functions.php(5464): ob_end_flush()\n#10 /home/otzerlin/public_html/wp-includes/class-wp-hook.php(324): wp_ob_end_flush_all()\n#11 /home/otzerlin/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()\n#12 /home/otzerlin/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()\n#13 /home/otzerlin/public_html/wp-includes/load.php(1279): do_action()\n#14 [internal function]: shutdown_action_hook()\n#15 {main}\n  thrown in /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/jsmin.php on line 212\n2025-03-08 18:40:48.426253 [NOTICE] [3454450] [T0] [127.0.0.1:49180#APVH_otzerling.com:443] [STDERR] PHP Fatal error:  Uncaught JSMin_UnterminatedStringException: JSMin: Unterminated String at byte 187: "Hola a todos  in /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/jsmin.php:212\nStack trace:\n#0 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/jsmin.php(150): JSMin->action()\n#1 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/jsmin.php(84): JSMin->min()\n#2 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/ao-minify-html.php(257): JSMin::minify()\n#3 [internal function]: AO_Minify_HTML->_removeScriptCB()\n#4 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/ao-minify-html.php(108): preg_replace_callback()\n#5 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/ao-minify-html.php(47): AO_Minify_HTML->process()\n#6 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/autoptimizeHTML.php(105): AO_Minify_HTML::minify()\n#7 /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/autoptimizeMain.php(592): autoptimizeHTML->minify()\n#8 [internal function]: autoptimizeMain->end_buffering()\n#9 /home/otzerlin/public_html/wp-includes/functions.php(5464): ob_end_flush()\n#10 /home/otzerlin/public_html/wp-includes/class-wp-hook.php(324): wp_ob_end_flush_all()\n#11 /home/otzerlin/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()\n#12 /home/otzerlin/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()\n#13 /home/otzerlin/public_html/wp-includes/load.php(1279): do_action()\n#14 [internal function]: shutdown_action_hook()\n#15 {main}\n  thrown in /home/otzerlin/public_html/wp-content/plugins/autoptimize/classes/external/php/jsmin.php on line 212\n2025-03-08 17:21:07.303341 [INFO] [3454451] [T0] [127.0.0.1:37656#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:20:58.899682 [INFO] [3454450] [T0] [127.0.0.1:40088#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:20:58.899662 [INFO] [3454450] [T0] [127.0.0.1:40088#APVH_otzerling.com:443] Auto Index is disabled for [/home/otzerlin/public_html/wp-includes/IXR/], access denied2025-03-08 17:20:33.299505 [INFO] [3454451] [T0] [127.0.0.1:36504#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:20:33.299486 [INFO] [3454451] [T0] [127.0.0.1:36504#APVH_otzerling.com:443] Auto Index is disabled for [/home/otzerlin/public_html/wp-content/upgrade/], access denied2025-03-08 17:20:08.958898 [INFO] [3454450] [T0] [127.0.0.1:57290#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:20:08.958878 [INFO] [3454450] [T0] [127.0.0.1:57290#APVH_otzerling.com:443] Auto Index is disabled for [/home/otzerlin/public_html/wp-admin/maint/], access denied2025-03-08 17:19:58.787845 [INFO] [3454450] [T0] [127.0.0.1:32944#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:19:58.787807 [INFO] [3454450] [T0] [127.0.0.1:32944#APVH_otzerling.com:443] Auto Index is disabled for [/home/otzerlin/public_html/wp-admin/css/], access denied2025-03-08 17:18:43.784816 [INFO] [3454450] [T0] [127.0.0.1:38902#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:18:43.784780 [INFO] [3454450] [T0] [127.0.0.1:38902#APVH_otzerling.com:443] Auto Index is disabled for [/home/otzerlin/public_html/wp-includes/], access denied2025-03-08 17:17:47.456948 [INFO] [3454450] [T0] [127.0.0.1:33780#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:17:47.456905 [INFO] [3454450] [T0] [127.0.0.1:33780#APVH_otzerling.com:443] Auto Index is disabled for [/home/otzerlin/public_html/wp-content/uploads/2022/07/], access denied2025-03-08 17:16:17.616514 [INFO] [3454451] [T0] [127.0.0.1:34486#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:16:17.616493 [INFO] [3454451] [T0] [127.0.0.1:34486#APVH_otzerling.com:443] Auto Index is disabled for [/home/otzerlin/public_html/wp-includes/Text/], access denied2025-03-08 17:15:28.606968 [INFO] [3454449] [T0] [127.0.0.1:41428#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:15:28.606948 [INFO] [3454449] [T0] [127.0.0.1:41428#APVH_otzerling.com:443] Auto Index is disabled for [/home/otzerlin/public_html/wp-includes/css/dist/widgets/], access denied2025-03-08 17:15:23.119860 [INFO] [3454450] [T0] [127.0.0.1:41372#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:15:22.090771 [INFO] [3454449] [T0] [127.0.0.1:58734#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:15:22.090739 [INFO] [3454449] [T0] [127.0.0.1:58734#APVH_otzerling.com:443] Auto Index is disabled for [/home/otzerlin/public_html/wp-admin/js/], access denied2025-03-08 17:14:49.808834 [INFO] [3454450] [T0] [127.0.0.1:38684#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml] 2025-03-08 17:14:49.808810 [INFO] [3454450] [T0] [127.0.0.1:38684#APVH_otzerling.com:443] Auto Index is disabled for [/home/otzerlin/public_html/wp-includes/js/tinymce/plugins/image/], access denied2025-03-08 17:13:51.456836 [INFO] [3454449] [T0] [127.0.0.1:60136#APVH_otzerling.com:443] File not found [/home/otzerlin/public_html/403.shtml]                     
       ```
   
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/#post-18351756)
 * OK, so the string “Hola te invitamos cordialmente a nuestras actividades de Agosto”,
   what page (URL) can I find that in?

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

1 [2](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/page/2/?output_format=md)

The topic ‘500 error when inlinecss and js is enabled’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 20 replies
 * 2 participants
 * Last reply from: [snippet24](https://wordpress.org/support/users/snippet24/)
 * Last activity: [1 year, 2 months ago](https://wordpress.org/support/topic/500-error-when-inlinecss-and-js-is-enabled/page/2/#post-18357925)
 * Status: resolved