Title: is wordpress theme run all code in function.php
Last modified: June 15, 2022

---

# is wordpress theme run all code in function.php

 *  [zestpush](https://wordpress.org/support/users/dhaka11021/)
 * (@dhaka11021)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/is-wordpress-theme-run-all-code-in-function-php/)
 * hey david i have some question
    1. i have a lot of short code defined inside 
   function.php so my question is “is every post run all shortcode’s functions whenever
   its not called in post” if yes than it is so harmful for loading speed because
   every shortcode function defined for different action. 2. how can i define a 
   shortcode that’s exicute or load when i call in post or page. dont load dummy
   code when its not called. 3. i see a custom hook name inside hook “what is this
   and where in website it will visible when i give a name `testing` to it” [⌊Capture223.JPG⌉](https://www.screencast.com/t/JKBRqqtlFUs)

Viewing 1 replies (of 1 total)

 *  [Leo](https://wordpress.org/support/users/leohsiang/)
 * (@leohsiang)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/is-wordpress-theme-run-all-code-in-function-php/#post-15740686)
 * Hi there,
 * 1. I believe so but I doubt it would have an impact on your site performance.
   This is handled by WordPress and not the theme so I would recommend checking 
   with WP’s support team if you need further clarifications.
 * 2. You would likely need to use an if statement with the correct conditional 
   tags:
    [https://codex.wordpress.org/Conditional_Tags](https://codex.wordpress.org/Conditional_Tags)
 * 3. The screenshot shown is from our Hook Elements module in GP Premium which 
   we aren’t allowed to support in the free theme forum here – it’s a WordPress 
   rule. Please open a support topic in our premium support forum:
    [https://generatepress.com/support/](https://generatepress.com/support/)
 * Please be mindful that the topics in this forum should be directly related to
   the free GeneratePress theme. If you have any general WP questions like #1 and#
   2 then a general WordPress forum like this might help: [https://wordpress.stackexchange.com/](https://wordpress.stackexchange.com/)
 * Thanks!

Viewing 1 replies (of 1 total)

The topic ‘is wordpress theme run all code in function.php’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/generatepress/3.6.1/screenshot.
   png)
 * GeneratePress
 * [Support Threads](https://wordpress.org/support/theme/generatepress/)
 * [Active Topics](https://wordpress.org/support/theme/generatepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/generatepress/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/generatepress/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Leo](https://wordpress.org/support/users/leohsiang/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/is-wordpress-theme-run-all-code-in-function-php/#post-15740686)
 * Status: not resolved