wordpress - Custom taxonomy and Custom post type error on class-wp-post-type.php -


with custom taxonomy, in local work correctly when try on domain-test see error message:

invalid argument supplied foreach() in domainsite/wp-includes/class-wp-post-type.php on line 634

the 634 code line reffered error this:

/**  * registers taxonomies post type.  *  * @since 4.6.0  * @access public  */ public function register_taxonomies() {     foreach ( $this->taxonomies $taxonomy ) {         register_taxonomy_for_object_type( $taxonomy, $this->name );     } } 

i search solution or workaround didn't find problem.

this taxonomy registration :

    function tipiricetta_taxonomy() {  $labels = array(     'name'                       => 'tipiricette',     'singular_name'              => 'tipiricetta',     'menu_name'                  => 'tipo ricetta',     'all_items'                  => 'tutti tipi ricetta',     'parent_item'                => 'genitore tipo ricetta',     'parent_item_colon'          => 'genitore tipo ricetta',     'new_item_name'              => 'nuovo tipo ricetta',     'add_new_item'               => 'aggiungi nuovo tipo',     'edit_item'                  => 'modifica tipo ricetta',     'update_item'                => 'aggiorna tipo ricetta',     'view_item'                  => 'visualizza tipo ricetta',     'separate_items_with_commas' => 'separa tipo ricetta con virgola',     'add_or_remove_items'        => 'aggiungi o rimuovi tipo ricetta',     'choose_from_most_used'      => 'scegli dai piĆ¹ utilizzati',     'popular_items'              => 'tipi ricetta popolari',     'search_items'               => 'cerca tipo ricetta',     'not_found'                  => 'non trovato',     'no_terms'                   => 'nessun tipo ricetta',     'items_list'                 => 'lista tipo ricetta',     'items_list_navigation'      => 'naviga tipo ricetta', ); $rewrite = array(     'slug'                       => '',     'with_front'                 => true,     'hierarchical'               => false, ); $args = array(     'labels'                     => $labels,     'hierarchical'               => true,     'public'                     => true,     'show_ui'                    => true,     'show_admin_column'          => true,     'show_in_nav_menus'          => false,     'show_tagcloud'              => false,     'rewrite'                    => $rewrite, );register_taxonomy( 'tipiricetta', array( 'ricette' ), $args );}add_action( 'init', 'tipiricetta_taxonomy', 0 ); 

this custom post type

// register custom post type   function ricette_post_type() {     $labels = array(     'name'                  => 'ricette',     'singular_name'         => 'ricetta',     'menu_name'             => 'ricette',     'name_admin_bar'        => 'ricette',     'archives'              => 'archivio ricette',     'attributes'            => 'attributi ricetta',     'parent_item_colon'     => 'genitore ricetta',     'all_items'             => 'tutte le ricette',     'add_new_item'          => 'aggiungi nuova ricetta',     'add_new'               => 'aggiungi nuova',     'new_item'              => 'nuova ricetta',     'edit_item'             => 'modifica ricetta',     'update_item'           => 'aggiorna ricetta',     'view_item'             => 'visualizza ridetta',     'view_items'            => 'visualizza ricette',     'search_items'          => 'cerca ricette',     'not_found'             => 'non trovata',     'not_found_in_trash'    => 'nono trovata nel cestino',     'featured_image'        => 'immagine in evidenza',     'set_featured_image'    => 'imposta immagine in evidenza',     'remove_featured_image' => 'rimuovi immagine in evidenza',     'use_featured_image'    => 'usa come immagine in evidenza',     'insert_into_item'      => 'inserisci nella ricetta',     'uploaded_to_this_item' => 'carica nella ricetta',     'items_list'            => 'lista ricette',     'items_list_navigation' => 'naviga lista ricette',     'filter_items_list'     => 'filtra lista ricette', ); $rewrite = array(     'slug'                  => 'ricette',     'with_front'            => false,     'pages'                 => true,     'feeds'                 => true, ); $args = array(     'label'                 => 'ricetta',     'description'           => 'ricette',     'labels'                => $labels,     'supports'              => array( 'title', 'editor', 'excerpt', 'thumbnail',),     'hierarchical'          => false,     'public'                => true,     'show_ui'               => true,     'show_in_menu'          => true,     'menu_position'         => 5,     'menu_icon'             => 'dashicons-carrot',     'show_in_admin_bar'     => true,     'show_in_nav_menus'     => true,     'can_export'            => true,     'has_archive'           => 'ricette',     'exclude_from_search'   => false,     'publicly_queryable'    => true,     'rewrite'               => $rewrite,     'capability_type'       => 'page',     'taxonomies'            => 'tipiricetta' );register_post_type( 'ricette', $args );}add_action( 'init', 'ricette_post_type', 0 ); 

and loop :

<?php if (have_posts()): ?>                 <?php while (have_posts()):the_post(); ?>                      <?php                     $terms = wp_get_post_terms(get_the_id(), 'tipiricetta');                     $output = array();                     $classi = "";                     foreach ($terms $val) {                         $output[] = '<a href="' . get_term_link($val) . '">' . $val->name . '</a>';                         $classi .= $val->slug . ' ';                     }                     ?>......<?php endwhile; ?> 

has suggestion? in local site don't have errors..and wp-backend can organize taxonomy , post type without problems. on altervista domain, end doesn't work correctly, example, if create new taxonomy have force page refresh see it, , if try modify custom post type ricette change taxonomy error appears , have refresh page see change.

thank in advance

sara


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -