Custom hooks | WordPress.org

[ad_1]

Hi,

I would like to use several wp_head custom hooks for the purpose of inserting one code above another code in the head.

To do this, I set the custom hooks as follows (hook name —> action —> priority):

Header —> wp_head —> 1
Header New —> wp_head —> 2

As you can see in the screenshot, both hooks are enabled.

https://i.ibb.co/S7nC7BK/hooks-01.png

Thus only one hook named Header is used in the block settings.
The second hook named Header New is not used neither in this block nor in any other.

https://i.ibb.co/nc3HhZD/hooks-02.png

And now begins the most interesting part.
If we look at the source code of the page, the code of the block, in which the hook named Header is used, starts to be doubled, as if this block also used the hook named Header New.
If I uncheck the option with hook named Header New then everything is fine.

https://i.ibb.co/Jcp0S53/hooks-03.png

Question: Why is it duplicated if I am not actually using a hook named Header New, but only pointing out that it can be used? Is this the way it should be?

In other words, should a plugin call a custom hook that is not in use?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer