Viewing 6 replies - 1 through 6 (of 6 total)
  • Daniel Olowu

    (@danielolowu)

    It means Priority. You can read more about it here

    Thread Starter gwenm

    (@gwenm)

    Thank you, I don’t understand better. It must be too complicated for me… the main thing is that it works ??

    Daniel Olowu

    (@danielolowu)

    Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. Default value: 10

    I hope this helps.

    Thread Starter gwenm

    (@gwenm)

    I understand the sentence but I don’t see what function(4) it refers to ..

    Daniel Olowu

    (@danielolowu)

    add_action( ‘wp_head’, ‘add_custom_meta_des’, 4 );

    The function is “add_custom_meta_des”

    Moderator bcworkz

    (@bcworkz)

    The 4 helps define the order in which various added callbacks are executed. Any added with priority 0 go first, then any added with 1, then 2, etc. Does that help in your understanding? That’s all you really need to know, but there is more to this if you’re interested.

    The default is 10 if not otherwise specified. If you used something like 64000 it’ll likely be executed last, even though much larger integers are possible. The absolute largest possible integer is assigned to the constant PHP_INT_MAX. Its value depends on the binary word width (commonly 64 bits wide) of your system.

    The order of execution of various callbacks added with the same priority value is officially undefined, but apparently in practice they execute in alphabetical order of function name. Not something to depend on.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘What does the 4 in this code mean?’ is closed to new replies.