Title: WordPress theme function running thrice
Last modified: March 8, 2025

---

# WordPress theme function running thrice

 *  Resolved [ugene](https://wordpress.org/support/users/ugene/)
 * (@ugene)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-theme-function-running-thrice/)
 * WordPress Version: 6.7.2
   TwentyTwentyFive: 1.1PHP: 8.1.2.9MySQL: 8.0.16Hi, I 
   am a simple function in my twentytwentyfive theme. Actually it has a long code,
   but just make my issue simpler. I wrote a logging code.The Issue:The function
   is being called 3 times and sometimes 4 times in one page refresh.I am putting
   a video here: [https://drive.google.com/file/d/1R8C9w-48-HcMHBDHK8K9xOujW9wxMoHs/view?usp=sharing](https://drive.google.com/file/d/1R8C9w-48-HcMHBDHK8K9xOujW9wxMoHs/view?usp=sharing)
   The question here is, is it normal thing.I know there conditions of checking 
   cron, checking ajax or admin, but does all codes runs multiple times if this 
   is the case.Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/wordpress-theme-function-running-thrice/#post-18349814)
 * Yes, that’s normal – but it also has to do with the fact that you don’t use any
   hooks for your individual code. If you run your logtest via the [init hook](https://developer.wordpress.org/reference/hooks/init/),
   for example, it will only be executed once.
 *  Thread Starter [ugene](https://wordpress.org/support/users/ugene/)
 * (@ugene)
 * [1 year ago](https://wordpress.org/support/topic/wordpress-theme-function-running-thrice/#post-18357098)
 * Hi [@threadi](https://wordpress.org/support/users/threadi/) , thank you for the
   reply. I got the gist 
   It is just bothersome to find out that things run like
   this.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WordPress theme function running thrice’ is closed to new replies.

## Tags

 * [WordPress](https://wordpress.org/support/topic-tag/wordpress/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [ugene](https://wordpress.org/support/users/ugene/)
 * Last activity: [1 year ago](https://wordpress.org/support/topic/wordpress-theme-function-running-thrice/#post-18357098)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
