• Hi All,

    My php skills are very limited and I’m trying to get WordPress Categories and all Custom Post Categories to display. From the research I’ve found, I need to use get_taxonomies or get_the_terms, but I get Warning: Invalid argument supplied for foreach()

    Here’s the original code:

    $cats_array = get_categories( 'hide_empty=0' );
    					foreach ( $cats_array as $categs ) {
    						printf( '<label><input type="checkbox" name="et_pb_include_categories" value="%1$s"%3$s> %2$s</label><br/>',
    							esc_attr( $categs->cat_ID ),
    							esc_html( $categs->cat_name ),
    							'<%= _.contains( et_pb_include_categories_temp, "' . $categs->cat_ID . '" ) ? checked="checked" : "" %>'
    						);
    					}

    Any help would be much appreciated. Thanks!

  • The topic ‘How To Display WordPress Categories and Custom Post Categories in Loop’ is closed to new replies.