Background: I have a childtheme folder of my Wordpress theme which contains a functions.php. In this functions.php, at the beginning, I wrote code for setting up a custom post type that allows the user to add events to the site. Everything worked fine until today when in the same file I added code for a further separate custom post type that allows the user to add people.
Problem: After having added the second custom post type code, I cannot login to my site anymore.
Cause of the problem: Via the error logfiles of my domain provider I found out that my code for registering "place" as a category causes the problem. I tried to register this taxonomy via add_action('init', 'cpt_reg_tax');
, followed by function cpt_reg_tax() { // code };
Now here comes what the error log file tells me: PHP Fatal error: Cannot redeclare cpt_reg_tax() (previously declared in ...
The thing is for the events custom post type at the beginning of functions.php I already registered a taxonomy. But why would PHP not allow me to register another taxonomy for another separate custom post type which comes later in the file?
How do I achieve that I can register a taxonomy for my second custom post type that I coded today without getting the redeclare-error again?