Home Forums WoodMart support forum Woodmart Custom JS

Woodmart Custom JS

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #563781

    Michael de Jager
    Participant

    Hi,
    is there a way that we can deactivate the custom js option in the woodmart theme?

    All three our websites keep on getting hacked through the custom js.

    Please will you look at this urgently.

    Thank you
    Regards
    Derick Carlson

    #563785

    Artem Temos
    Keymaster

    Hello,

    The fact that someone is adding custom code to your website only indicates that someone has access to your site. This doesn’t necessarily mean that your site is being compromised through the custom field in the theme settings. You need to investigate how exactly your site was compromised and change all passwords. If you’d like, we can advise on where you can remove this field from the code, but it’s unlikely to change anything as long as the attackers have access to your site.

    Kind Regards

    #563790

    Michael de Jager
    Participant

    Is there a way to disable this because we have another custom js plugin that we use and have never had strange code in there?

    We have Solid Security and Sucuri on the website and have done a password reset on all three websites.

    We also have a plugin that monitors the changes on the backend and the code does not get added manually by a user.

    All three of our websites have different passwords yet the code gets added to all three.

    Even if we deactivate all the plugins it still gets added in only the woodmart custom js

    #563855

    Artem Temos
    Keymaster

    Try to add the following PHP code snippet to the child theme functions.php file to disable this option and not output any Custom JS code on your website.

    add_filter(
        'woodmart_option',
        function ( $opt, $slug ) {
            if ( in_array( $slug, array( 'custom_js', 'js_ready' ), true ) ) {
                $opt = '';
            }
    
            return $opt;
        },
        10,
        2
    );

    To hide this field, you can also edit the file wp-content\themes\woodmart\inc\classes\class-theme.php and remove this line

    'admin/settings/custom-js',

    also edit this file wp-content\themes\woodmart\inc\admin\settings\sections.php and remove the following code

    /**
     * Custom JS section.
     */
    Options::add_section(
    	array(
    		'id'       => 'custom_js',
    		'name'     => esc_html__( 'Custom JS', 'woodmart' ),
    		'priority' => 190,
    		'icon'     => 'xts-i-file-code-js',
    	)
    );
Viewing 4 posts - 1 through 4 (of 4 total)