Name: wph/components/components_run/ignore_component
Type: Filter
Arguments:
(bool) $ignore_component
(text) $component_id
($saved_field_value) $component_id
(object) $_class_instance
Using this filter, specific components can be disabled.
The following example disables the HTML Minification component on URL ‘/elementor-188’:
add_filter( 'wph/components/components_run/ignore_component', '__wph_ignore_component', 10, 4 );
function __wph_ignore_component ( $ignore_component, $component_id, $saved_field_value, $_class_instance )
{
$current_url = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if ( $component_id == 'remove_html_new_lines' && strpos( $current_url, '/elementor-188' ) !== FALSE )
$ignore_component = TRUE;
return $ignore_component;
}
To check for multiple URLs and the HTML Remove Comments component, the following code can be used:
add_filter( 'wph/components/components_run/ignore_component', '__wph_ignore_component', 10, 4 );
function __wph_ignore_component ( $ignore_component, $component_id, $saved_field_value, $_class_instance )
{
$current_url = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$urls = array ( '/elementor-188', '/contact-us', '/another-page' );
if ( $component_id == 'remove_html_comments' && strposa( $current_url, $urls ) !== FALSE )
$ignore_component = TRUE;
return $ignore_component;
}
function strposa ( string $haystack, array $needles, int $offset = 0 )
{
foreach ( $needles as $needle )
{
if ( strpos ( $haystack, $needle, $offset ) !== FALSE )
return TRUE;
}
return FALSE;
}
To identify each of the component ids, see the files at /wp-hide-security-enhancer-pro/modules/components/. Or use the browser Inspector to highlight the option input. The form element name is the corresponding component id.
Important!
Disabling specific components may break the layout and functionality of the page. For example, suppressing the component ‘new_content_path’ which changes the default /wp-content/, while blocking the default, creates issues, as the default files can’t load anymore through the default url.