Title: Deprecated preg_replace_callback()
Last modified: October 23, 2026

---

# Deprecated preg_replace_callback()

 *  [calliko](https://wordpress.org/support/users/calliko/)
 * (@calliko)
 * [6 days, 7 hours ago](https://wordpress.org/support/topic/deprecated-preg_replace_callback/)
 * Deprecated preg_replace_callback(): Passing null to parameter #3 ($subject) of
   type array|string is deprecated
    1. wp-content/plugins/autoptimize/classes/external/php/ao-minify-html.php:118
 * php 8.3
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdeprecated-preg_replace_callback%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [softglaze](https://wordpress.org/support/users/softglaze/)
 * (@softglaze)
 * [5 days, 6 hours ago](https://wordpress.org/support/topic/deprecated-preg_replace_callback/#post-19053691)
 * Hi, this notice usually means one of the inline style blocks on that page is 
   very large (roughly more than 1 MB of CSS inside a single style tag). When a 
   block is that big, PHP’s regular expression engine hits its backtrack limit (
   pcre.backtrack_limit, 1000000 by default), so the Autoptimize HTML minifier gets“
   null” instead of the page HTML, and PHP 8.3 shows this deprecation notice.
 * It is only a notice: the page still loads, and Autoptimize simply skips HTML 
   minification for that page.
 * A few ways to solve it:
    1. Find what adds the large inline CSS (often a page builder or a theme option)
       and set it to load the CSS as a file instead of inline.
    2. Ask your host to raise pcre.backtrack_limit, for example to 10000000.
    3. Or turn off “Optimize HTML Code” in Settings > Autoptimize.
 * On a live site you can also keep notices off the screen by setting WP_DEBUG_DISPLAY
   to false: [https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/](https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/)
 * Which theme or page builder does that page use? That will help find where the
   large inline style comes from.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [5 days, 5 hours ago](https://wordpress.org/support/topic/deprecated-preg_replace_callback/#post-19053731)
 * thanks [@softglaze](https://wordpress.org/support/users/softglaze/) some good
   points there, the amount of HTML (including large amounts of inline CSS & JS)
   indeed seems to be the root cause! 🙂
 * I think “inline all CSS” in Autoptimize is active now, disabling that would be
   a first step. if you want to ensure the CSS is not render-blocking, you should
   go down the “critical CSS” path, manually creating rules OR taking an AOPro subscription
   to have those rules generated automatically.
 * Lastly; line 118 is where comment removal in the HTML minifier starts, so enabling“
   keep comments” might help in this case. additionally disabling “minify inline
   CSS/ JS” might also prove useful.
 * hope this helps,
    frank (ao dev)
 *  [softglaze](https://wordpress.org/support/users/softglaze/)
 * (@softglaze)
 * [4 days, 22 hours ago](https://wordpress.org/support/topic/deprecated-preg_replace_callback/#post-19053914)
 * Thanks [@futtta](https://wordpress.org/support/users/futtta/), happy to help,
   and thanks for adding the details about line 118 and the inline CSS settings.
 * [@calliko](https://wordpress.org/support/users/calliko/), I would start with 
   Frank’s first step: in Settings > Autoptimize, uncheck “Inline all CSS?”, save,
   clear the cache and check the page again. If the notice is still there, check“
   Keep HTML comments?” next. Let us know which one fixes it for you.

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

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdeprecated-preg_replace_callback%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](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/)

 * 3 replies
 * 3 participants
 * Last reply from: [softglaze](https://wordpress.org/support/users/softglaze/)
 * Last activity: [4 days, 22 hours ago](https://wordpress.org/support/topic/deprecated-preg_replace_callback/#post-19053914)
 * Status: not resolved