• I’m getting the following error in the admin area & front-end of my site:

    Warning: Invalid argument supplied for foreach() in /home/content/a/s/c/path/to/server/website/blah/wp-includes/post.php on line 1035

    I recently changed the FTP URL & got the site working, all except for this error. I have tried updating WP (3.2.1) & that didn’t help. Now, the error only goes away when I swap themes.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter gaberosser

    (@gaberosser)

    I just narrowed this down further to my Custom Post Type in functions.php. Apparently it doesn’t like this?

    add_action( 'init', 'register_cpt_feature' );
    
    function register_cpt_feature() {
    
        $labels = array(
            'name' => _x( 'Features', 'feature' ),
            'singular_name' => _x( 'Feature', 'feature' ),
            'add_new' => _x( 'Add New', 'feature' ),
            'add_new_item' => _x( 'Add New Feature', 'feature' ),
            'edit_item' => _x( 'Edit Feature', 'feature' ),
            'new_item' => _x( 'New Feature', 'feature' ),
            'view_item' => _x( 'View Feature', 'feature' ),
            'search_items' => _x( 'Search Features', 'feature' ),
            'not_found' => _x( 'No features found', 'feature' ),
            'not_found_in_trash' => _x( 'No features found in Trash', 'feature' ),
            'parent_item_colon' => _x( 'Parent Feature:', 'feature' ),
            'menu_name' => _x( 'Billboard', 'feature' ),
        );
    
        $args = array(
            'labels' => $labels,
            'hierarchical' => false,
            'description' => '4-at-a-time Rotating Feature Billboard',
            'supports' => array( 'title', 'thumbnail', 'page-attributes', 'custom-fields' ),
            'taxonomies' => false,
            'public' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'menu_position' => 5,
            'show_in_nav_menus' => true,
            'publicly_queryable' => true,
            'exclude_from_search' => true,
            'has_archive' => false,
            'query_var' => true,
            'can_export' => true,
            'rewrite' => false,
            'capability_type' => 'page'
        );
    
        register_post_type( 'feature', $args );
    }

    I feel like the more I discover, the less I know.

    I’m having the same problem exactly.

    Did you find a solution?

    It seems to happen when the ‘taxonomies’ arg is set. Any luck fixing this?

    jmeher

    (@jmeher)

    Same here, when ‘taxonomies’ are set? The question is do I need to have these taxonomies set for them to work if I register them for my custom post type? I guess I will find out but would like to know if something ever comes of this.

    AngelEyes

    (@clustervision)

    hmm.. just got this when i tried to set taxonomies as well. I have my taxonomy registered properly and everything..

    Dennis Pedrie

    (@dennispedrie)

    Pass the value as an array.

    i.e. array(‘post_tag’, ‘categories’)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Invalid argument supplied for foreach()’ is closed to new replies.