• Resolved jockoe

    (@jockoe)


    I created a taxonomy called “Equipment” in the Code Snippets plugin and it works perfectly. So I CLONED it and made all the necessary edits for a second custom taxonomy called “Software”. I was able to save it, but when trying to activate it I got the error

    The snippet has been deactivated due to an error on line 3:
    Cannot redeclare function custom_taxonomy.

    Line 3 is a blank line. Anyone know what might be causing this error?

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    You are using the same function name in both snippets. Either change the function name, or even better convert them to use anonymous functions by writing like this:

    add_action( 'init', function () {
        // taxonomy code goes here
    } );

    Instead of this:

    add_action( 'init', 'custom_taxonomy' );
    
    function custom_taxonomy() {
        // taxonomy code goes here
    }
Viewing 1 replies (of 1 total)

The topic ‘Multiple Taxonomies’ is closed to new replies.