BLACK FRIDAY & CYBER MONDAY SALE! 30% DISCOUNT!! Coupon code:bf30 Enjoy!!!

The same functions.php code is in both parent theme and child theme

Home Forums Spacious Free The same functions.php code is in both parent theme and child theme

This topic contains 10 replies, has 3 voices, and was last updated by  Ashish 6 days, 8 hours ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1392625

    cagross
    Participant

    Hello. My site uses a child theme, with your theme as the parent theme. At the top of the parent theme’s functions.php file are ~200 lines of code, starting with line 1, and ending with the lines:

    //$start_wp_theme_tmp
    //wp_tmp
    //$end_wp_theme_tmp

    I have noticed that this exact same code is also in my child theme’s functions.php file. I’m not sure how this code arrived in my child theme’s functions.php file. But it is OK to remove this code from my child theme’s functions.php file?

    Thank you.

    #1392641

    Rajesh
    Moderator

    Hi @cagross,

    If you don’t need those code then you can remove the code from the child theme’s function.php file.

    Thanks.

    #1392781

    cagross
    Participant

    >> If you don’t need those code then you can remove the code from the child theme’s function.php file.

    Well I was hoping you would tell me whether or not I need this code in my child theme’s functions.php. Can you tell me if I need this code in my child theme’s functions.php file? The exact same code is also in my parent theme’s functions.php. I don’t want to post the code here, because it is long, and may contain sensitive information. But if you want to know exactly what code it is, the code is lines 1 – 183 of the parent theme’s functions.php (theme version 1.5.5).

    Thanks.

    #1393012

    Rajesh
    Moderator

    Hi @cagross,

    You don’t need the same code in both the parent and the child theme’s function.php file. You can remove it from the child theme. You can take a reference on what is needed in the child theme from the following link.
    https://themegrill.com/blog/tutorial-creating-wordpress-child-theme/
    Thanks.

    #1393018

    cagross
    Participant

    OK thanks for that. I’m not sure how the code was inserted into my child theme. I am the admin of the site and I’m pretty sure I did not do that.

    Anyway, I removed it and all is well. We can consider this resolved.

    #1393020

    cagross
    Participant

    Actually sorry, this issue is not yet resolved. Here is an update. If I delete the code from my child functions.php file, it remains deleted, even if I close and re-open the file. But if I in-turn open my home page in a browser, that code is automatically re-entered into my child functions.php file. Why is this occurring and how can I resolve it?

    Thanks.

    #1393780

    Ashish
    Moderator

    Hi @cagross
    I’m not sure how did the code automatically added to the child theme’s file. That’s strange. How did you edited the file?

    #1393792

    cagross
    Participant

    >> I’m sure how did the code automatically added to the child theme’s file. That’s strange. How did you edited the file?

    I don’t understand what you are saying here. Can you clarify a bit?

    If you want login details to my site, I can give them to you and you can observe the issue for yourself.

    Thanks.

    #1393878

    Ashish
    Moderator

    Sorry. I mean to say I’m not sure.
    Anyways, yes, you can create a login for us and send us at team@themegrill.com. Thanks.

    #1394070

    Ashish
    Moderator

    Hi, @cagross
    After checking those codes on your child theme and researching about this, I guess those code are malware. So, I suggest you to check in detail about this or talk a help from a professional on this. Please read the following articles on what you can do.

    https://www.wpbeginner.com/beginners-guide/beginners-step-step-guide-fixing-hacked-wordpress-site/

    Also, Please consider our security guide in future to keep your site safe.

    https://themegrill.com/blog/wordpress-security-tips/

    Thanks.

    #1394150

    cagross
    Participant

    OK. It is unfortunate that it took you 11 days to confirm that. Now I’m not sure if I have a valid backup.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.