WordPress.org

Ready to get started?Download WordPress

Forums

Invalid argument error on my custom taxonomy (3 posts)

  1. Cathy Tibbles
    Member
    Posted 3 years ago #

    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' )
    ));
     }
  2. Cathy Tibbles
    Member
    Posted 3 years ago #

    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

  3. mores
    Member
    Posted 3 years ago #

    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 :)

Topic Closed

This topic has been closed to new replies.

About this Topic