• Resolved mattce

    (@mattce)


    Hi,
    I’m not sure if it’s a problem on how about this plugin is registering the taxonomies via code or if it’s a general problem of wordpress, sorry for that.

    My problem:

    1) I’m using your “get code” feature and adding the snippet it into my functions.php
    2) I’m deleting the previous taxonomy in your plugin backend that it’s not registered twice

    From backend site, everything seems fine, the taxonomy appears and I’m still able to create new terms, but when I’m trying to use get_terms() or get_taxonomies() in my template, this taxonomy is not part of the output, get_terms() tells me, it’s invalid, get_taxonomy does not list it either.

    Any idea, why the taxonomy is not accessible with these functions? Do I need to change the priority to make it work?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Did you make sure to copy/paste the add_action( ... ); line as well? With the exception of some parts, those should generally be the same.

    add_action( 'init', 'cptui_register_my_cpts_movie' );
    

    As an example from my local install. You’d just need to match up the cptui_register_my_cpts_movie with the function name you copy/pasted.

    Thread Starter mattce

    (@mattce)

    Hi Michael, sorry for the late response. Yes, I’ve added this piece of code, in my case I’m using

    add_action( 'init', 'cptui_register_my_taxes' ); for my cptui_register_my_taxes() function

    as suggested in the plugin’s export page directly.

    “Query monitor” (the plugin) is also showing an error:

    Invalid argument supplied for foreach() in wp-includes/class-wp-post-type.php:655

    This part is looping the taxonomies that should get registered:

    public function register_taxonomies() {
    foreach ( $this->taxonomies as $taxonomy ) {
    register_taxonomy_for_object_type( $taxonomy, $this->name );
    }
    }

    I don’t know what’s wrong, the taxonomy appears in the backend, creating terms is also working, but some wp functions claim, that it’s invalid. But seems, that I’m the only one with this problem, since no one else is complaining about it. ??

    For the moment I’ve disabled the init action and let the plugin doing its magic to register the post type by itself. Via code in the functions.php was useful since I’m needing them on several subsites on my multisite installation, but no drama. We’ll see if someone else is also confronted with the same issue.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Can you paste me the “get code” version you’re trying to use, in full? I’m curious about some parts of that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Taxonomies created via “Get Code” are not showing up in get_taxonomies()’ is closed to new replies.