Title: Cannot break/continue error in taxonomy.php
Last modified: August 19, 2016

---

# Cannot break/continue error in taxonomy.php

 *  [catbegemot](https://wordpress.org/support/users/catbegemot/)
 * (@catbegemot)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/cannot-breakcontinue-error-in-taxonomyphp/)
 * I am currently on development versions and have encountered this error since 
   a few days ago. Updated just now and still see this error, so I assume it is 
   still unresolved.
 * The full error message I am getting is
 * > Fatal error: Cannot break/continue 1 level in <path here>/wp-includes/taxonomy.
   > php on line 466
 * when trying to create a new post (wp-admin/post-new.php).
 * I looked into the code and here’s the snippet where the error is occurred:
 *     ```
       function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
       	global $wpdb;
   
       	extract( wp_parse_args( $args, array(
       		'include_children' => false,
       		'field' => 'term_id',
       		'operator' => 'IN',
       		'do_query' => true,
       	) ), EXTR_SKIP );
   
       	$taxonomies = (array) $taxonomies;
   
       	foreach ( $taxonomies as $taxonomy ) {
       		if ( ! taxonomy_exists( $taxonomy ) )
       			return new WP_Error( 'invalid_taxonomy', sprintf( __( 'Invalid Taxonomy: %s' ), $taxonomy ) );
       	}
   
       	$terms = array_unique( (array) $terms );
       //====================== ERROR HAPPENS HERE! ===============
       	if ( empty($terms) )
       		continue;
       //====================== ERROR HAPPENS HERE! ===============
   
       	if ( !in_array( $field, array( 'term_id', 'slug', 'name' ) ) )
       		$field = 'term_id';
   
       	if ( !in_array( $operator, array( 'IN', 'NOT IN' ) ) )
       		$operator = 'IN';
   
       	$taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
   
       	switch ( $field ) {
       		case 'term_id':
       			$terms = array_map( 'intval', $terms );
   
       			if ( is_taxonomy_hierarchical( $taxonomy ) && $include_children ) {
       				$children = $terms;
       				foreach ( $terms as $term )
       					$children = array_merge( $children, get_term_children( $term, $taxonomy ) );
       				$terms = $children;
       			}
   
       			$terms = implode( ',', $terms );
       			$sql = "
       				SELECT object_id
       				FROM $wpdb->term_relationships
       				INNER JOIN $wpdb->term_taxonomy USING (term_taxonomy_id)
       				WHERE taxonomy IN ($taxonomies)
       				AND term_id $operator ($terms)
       			";
       		break;
   
       		case 'slug':
       		case 'name':
       			foreach ( $terms as $i => $term ) {
       				$terms[$i] = sanitize_term_field('slug', $term, 0, $taxonomy, 'db');
       			}
       			$terms = array_filter($terms);
   
       			$terms = "'" . implode( "','", $terms ) . "'";
       			$sql = "
       				SELECT object_id
       				FROM $wpdb->term_relationships
       				INNER JOIN $wpdb->term_taxonomy USING (term_taxonomy_id)
       				INNER JOIN $wpdb->terms USING (term_id)
       				WHERE taxonomy IN ($taxonomies)
       				AND $field $operator ($terms)
       			";
       		break;
       	}
   
       	if ( !$do_query )
       		return $sql;
   
       	return $wpdb->get_col( $sql );
       }
       ```
   
 * As you can see the **_if()_** statement is not in any loop, therefore **_continue_**
   statement is producing fatal error.
 * Simply commenting out the **_if()…continue_** structure looks Ok and works in
   my case, but it will go away with the next update. In any case – this should 
   be looked at.
 * Server info:
    PHP Version 5.2.12 running as suphp (CGI)

The topic ‘Cannot break/continue error in taxonomy.php’ is closed to new replies.

## Tags

 * [new-post](https://wordpress.org/support/topic-tag/new-post/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)

 * In: [Alpha/Beta/RC](https://wordpress.org/support/forum/alphabeta/)
 * 0 replies
 * 1 participant
 * Last reply from: [catbegemot](https://wordpress.org/support/users/catbegemot/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/cannot-breakcontinue-error-in-taxonomyphp/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
