• Resolved ugene

    (@ugene)


    WordPress Version: 6.7.2
    TwentyTwentyFive: 1.1
    PHP: 8.1.2.9
    MySQL: 8.0.16

    Hi, 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

    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)
  • 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, for example, it will only be executed once.

    Thread Starter ugene

    (@ugene)

    Hi @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)
  • You must be logged in to reply to this topic.