• Cathy Mitchell

    (@multitalentedmommy)


    This error: Invalid argument supplied for foreach() in /home/dswp/public_html/userylf/wp-includes/post.php on line 1016 is coming back. When I checked the file it appears something is wrong with my taxonomies. I have no idea what, I’ve rewritten them a hundred times and checked against codex. Perhaps a fresh set of eyes? THanks!!

    add_action( 'init', 'create_film_categories' );
    function create_film_categories() {
    
      $labels = array(
        'name' => _x( 'Film Types', 'taxonomy general name' ),
        'singular_name' => _x( 'Film Types', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Film Type' ),
        'all_items' => __( 'All Film Types' ),
        'parent_item' => __( 'Parent Film Type' ),
        'parent_item_colon' => __( 'Parent Film Type:' ),
        'edit_item' => __( 'Edit Film Type' ),
        'update_item' => __( 'Update Film Type' ),
        'add_new_item' => __( 'Add New Type' ),
        'new_item_name' => __( 'New Type Name' ),
        'menu_name' => __( 'Film Types' )
      );
    register_taxonomy('filmtypes',array('filmentries'),array(
      'hierarchical' => true,
      'labels' => $labels,
      'show_ui' => true,
      'query_var' => true,
     'rewrite' => array( 'slug' => 'filmtypes' )
    ));
     }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Cathy Mitchell

    (@multitalentedmommy)

    The problem was in the custom post type not in the taxonomy. If anyone else needs this answer –

    the taxonomies argument in the register_post_type is an ARRAY. lol

    Thanks man. This one made my day.
    I thought that when I only need categories, I can remove the array and just write “categories”. But that screwed things up ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Invalid argument error on my custom taxonomy’ is closed to new replies.