Home › Forums › Support › Hooks Element or Code Snippets? This topic has 5 replies, 2 voices, and was last updated 4 years, 5 months ago by Leo. Viewing 6 posts - 1 through 6 (of 6 total) Author Posts December 30, 2018 at 9:53 am #769296 Rui As said in docs.generatepress.com/article/adding-php/ we can use Code Snippets plugin to add a function to our websites or to hook something into the theme. But we also could use the Hook Element (native of GP). So… Why use Code Snippets? Is there any situation where it is essential and the Hook Elements can not do work? Or we can basically run any PHP code ‘wherever’ we want on theme (using Hooks) without installing the plugin? December 30, 2018 at 10:08 am #769305 LeoStaff Customer Support Hi there, Simple answer is no. Hooks are only used for content you want to run in that specific hook. Things like filters and other custom functions need to be added using the adding PHP methods. Hope this helps! December 30, 2018 at 2:39 pm #769472 Rui Well, let me see if I got it. So, if I need to execute PHP code on certain pages the Hook Element will be the soluction. But if have specific functions and filters on my theme (and do not create a child theme) then I should install the Code Snippets plugin. Is it something like that? December 30, 2018 at 3:23 pm #769477 LeoStaff Customer Support Not quite. So, if I need to execute PHP code on certain pages the Hook Element will be the soluction. If you need the PHP code to execute inside specific hook then yes. A plugin like Code Snippet should have minimal impact on the speed of your site so I really wouldn’t worry about it. December 30, 2018 at 6:32 pm #769553 Rui Ok, Leo. Thank you. I’m still getting familiar with these details! Happy New Year! December 31, 2018 at 10:05 am #770018 LeoStaff Customer Support Happy new year to you too 🙂 Author Posts Viewing 6 posts - 1 through 6 (of 6 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In