@@ 1981-1995 (lines=15) @@ | ||
1978 | if ( empty( $term_data['name'] ) ) |
|
1979 | return new IXR_Error( 403, __( 'The term name cannot be empty.' ) ); |
|
1980 | ||
1981 | if ( isset( $content_struct['parent'] ) ) { |
|
1982 | if ( ! $taxonomy['hierarchical'] ) |
|
1983 | return new IXR_Error( 403, __( 'This taxonomy is not hierarchical.' ) ); |
|
1984 | ||
1985 | $parent_term_id = (int) $content_struct['parent']; |
|
1986 | $parent_term = get_term( $parent_term_id , $taxonomy['name'] ); |
|
1987 | ||
1988 | if ( is_wp_error( $parent_term ) ) |
|
1989 | return new IXR_Error( 500, $parent_term->get_error_message() ); |
|
1990 | ||
1991 | if ( ! $parent_term ) |
|
1992 | return new IXR_Error( 403, __( 'Parent term does not exist.' ) ); |
|
1993 | ||
1994 | $term_data['parent'] = $content_struct['parent']; |
|
1995 | } |
|
1996 | ||
1997 | if ( isset( $content_struct['description'] ) ) |
|
1998 | $term_data['description'] = $content_struct['description']; |
|
@@ 2085-2099 (lines=15) @@ | ||
2082 | return new IXR_Error( 403, __( 'The term name cannot be empty.' ) ); |
|
2083 | } |
|
2084 | ||
2085 | if ( ! empty( $content_struct['parent'] ) ) { |
|
2086 | if ( ! $taxonomy['hierarchical'] ) |
|
2087 | return new IXR_Error( 403, __( "This taxonomy is not hierarchical so you can't set a parent." ) ); |
|
2088 | ||
2089 | $parent_term_id = (int) $content_struct['parent']; |
|
2090 | $parent_term = get_term( $parent_term_id , $taxonomy['name'] ); |
|
2091 | ||
2092 | if ( is_wp_error( $parent_term ) ) |
|
2093 | return new IXR_Error( 500, $parent_term->get_error_message() ); |
|
2094 | ||
2095 | if ( ! $parent_term ) |
|
2096 | return new IXR_Error( 403, __( 'Parent term does not exist.' ) ); |
|
2097 | ||
2098 | $term_data['parent'] = $content_struct['parent']; |
|
2099 | } |
|
2100 | ||
2101 | if ( isset( $content_struct['description'] ) ) |
|
2102 | $term_data['description'] = $content_struct['description']; |