You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to parse HTML with regular expressions is cumbersome, error-prone and ultimately futile.
A safer (and potentially more efficient) approach would be to use the DOM extension instead.
The DOM extension is not a hard requirement for running WordPress - based on a brief look into the code, all calls to DOM extension functionality in the WP core seem to be guarded with class_exists() checks to prevent errors. However, the extension is enabled in PHP by default (see here), and is listed as a required module for WordPress in the WP Extension Check command for WP-CLI.
The following would be necessary to move to the DOM extension:
(optional) Implement a performance check for the filter_*() functions (to get a before/after comparison)
Re-implement the filter_*() functions using the DOM extension
Add a check to the plugin that disables all functionality and shows a warning if the DOM extension is not active
The text was updated successfully, but these errors were encountered:
Trying to parse HTML with regular expressions is cumbersome, error-prone and ultimately futile.
A safer (and potentially more efficient) approach would be to use the DOM extension instead.
The DOM extension is not a hard requirement for running WordPress - based on a brief look into the code, all calls to DOM extension functionality in the WP core seem to be guarded with
class_exists()
checks to prevent errors. However, the extension is enabled in PHP by default (see here), and is listed as a required module for WordPress in the WP Extension Check command for WP-CLI.The following would be necessary to move to the DOM extension:
filter_*()
functions (to get a before/after comparison)filter_*()
functions using the DOM extensionThe text was updated successfully, but these errors were encountered: