Note that there are some explanatory texts on larger screens.

plurals
  1. POget_terms return errors
    primarykey
    data
    text
    <p>Hi when i try to <code>get_terms();</code> in theme options via this code</p> <pre><code>$catalogs_terms = get_terms( 'catalogs' ); $mycatalogs = array( -1 =&gt; 'Select a catalog' ); if ( $catalogs_terms ) { foreach ( $catalogs_terms as $catalog_term ) { $mycatalogs[$catalog_term-&gt;term_id] = $catalog_term-&gt;name; } } </code></pre> <p>return empty but this code is working fine every where in pages etc. when i try to <code>print_r( $catalogs_terms )</code> output i am getting errors </p> <pre><code>Array ( [errors] =&gt; Array ( [invalid_taxonomy] =&gt; Array ( [0] =&gt; Invalid Taxonomy ) ) [error_data] =&gt; Array ( ) ) </code></pre> <p>i don't understand where am i wrong? my function for register taxonomy</p> <pre><code> add_action( 'init', 'my_taxonomies', 0 ); function my_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' =&gt; _x( 'Catalogs', 'taxonomy general name' ), 'singular_name' =&gt; _x( 'Catalog', 'taxonomy singular name' ), 'search_items' =&gt; __( 'Search Catalogs', 'mytextdomain' ), 'all_items' =&gt; __( 'All Catalogs', 'mytextdomain' ), 'parent_item' =&gt; __( 'Parent Catalog', 'mytextdomain' ), 'parent_item_colon' =&gt; __( 'Parent Catalog:', 'mytextdomain' ), 'edit_item' =&gt; __( 'Edit Catalog', 'mytextdomain' ), 'update_item' =&gt; __( 'Update Catalog', 'mytextdomain' ), 'add_new_item' =&gt; __( 'Add New Catalog', 'mytextdomain' ), 'new_item_name' =&gt; __( 'New Catalog Name', 'mytextdomain' ), 'menu_name' =&gt; __( 'Catalogs', 'mytextdomain' ), ); // register catalogs hierarchical (like categories) register_taxonomy( 'catalogs', array( 'news' ), array( 'hierarchical' =&gt; true, 'labels' =&gt; $labels, 'show_ui' =&gt; true, 'public' =&gt; true, 'query_var' =&gt; true, 'rewrite' =&gt; array( 'slug' =&gt; 'catalogs' ) ) ); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload