Warning: Invalid argument supplied for foreach() in post.php [closed]

In WordPress 4.5.3, there’s a foreach in wp-includes/post.php on line 1177 and no others around it, so I’m guessing this is the one that’s triggering the error in your install on line 1172. This is inside the register_post_type() function, and it’s looping through the taxonomies argument that you’re sending through. Well… that you were meant … Read more

Print current post category during WP_Query

You are using the get_the_terms() but this function is used to get the custom taxonomies. Use the function get_the_category(); inside the WordPress loop and pass the get_the_ID() function which will get the current post ID in the loop. get_the_category(get_the_ID()); <?php $args = array( ‘post_type’ => ‘work’, ‘posts_per_page’ => ‘9’ ); $work_loop = new WP_Query( $args … Read more