[Resolved] Adding to functions.php (no child theme)

Home Forums Support Adding to functions.php (no child theme)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #1037380

    Hey there!

    I am upgrading my website theme to GeneratePress and trying to move all my existing snippets and tracking codes over (currently working on a staging copy). I have a piece of code to add to the functions.php file but when I go to the theme editor it’s saying “Please do not make any edits to this file. All edits should be done in a child theme.”

    But I don’t have any child theme. I’m using the Generatepress theme and the Pro plugin and just customizing things from scratch. In the Themes, the only theme that’s active is Generatepress.

    The code I want to add relates to a social share plugin, to force Pinterest hidden images to be excluded from lazy loading. the code is included in my old theme so I am not sure why I can’t place it in the functions.php of the new theme. Is there another location?
    Also, I’d prefer not to have to use a plugin to add this code.
    Thank you so much!

    Customer Support

    Hi there,

    It’s never a good idea to add modify the theme core files like style.css or functions.php as they will be erased during updates.

    Try using one of the methods here instead:

    I’d say Code Snippets is the easiest solution and we use it all the time.

    If not the next best option is the child theme’s functions.php.

    Let me know if this helps 🙂


    Hi Leo,

    Thank you for your quick response.
    As I said before I am not using a Child theme, so I was confused when I read I can only add it to the child theme. Do you mean one of those site library themes? because I’m not using any of those.

    I looked at that article before… So if I add that plugin, can I delete it after the code is added?
    The reason I am changing my theme is to help speed up my website which has been extremely slow on my last theme and part of that was also removing unnecessary plugins… that’s why I asked 🙂

    Thank you

    Customer Support

    It would be a blank child theme:

    No you cannot remove the plugin and keep the code activated. The plugin should have very minimal impact to your site speed.

    You can run your site through speed test before and after.


    Ohh I see! thank you so much. I’m gonna check out the articles now and try the plugin also.


    Customer Support
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.