In the script below, does the order in which items are declared matter?
For example, if the add_action points to a function that has not yet been defined? Does it ma
From the PHP manual:
Functions need not be defined before they are referenced, except when a function is conditionally defined as shown in the two examples below.
However, while this is more of a personal preference, I would highly recommend including all the functions you actually use in an external functions.php
file then using a require_once()
or include_once()
(depending on tastes) at the very top of your main PHP file. This makes more logical sense -- if someone else is reading your code, it is blindingly obvious that you are using custom functions and they are located in functions.php
. Saves a lot of guesswork IMO.