@@ 1901-1915 (lines=15) @@ | ||
1898 | if ( empty( $term_data['name'] ) ) |
|
1899 | return new IXR_Error( 403, __( 'The term name cannot be empty.' ) ); |
|
1900 | ||
1901 | if ( isset( $content_struct['parent'] ) ) { |
|
1902 | if ( ! $taxonomy['hierarchical'] ) |
|
1903 | return new IXR_Error( 403, __( 'This taxonomy is not hierarchical.' ) ); |
|
1904 | ||
1905 | $parent_term_id = (int) $content_struct['parent']; |
|
1906 | $parent_term = get_term( $parent_term_id , $taxonomy['name'] ); |
|
1907 | ||
1908 | if ( is_wp_error( $parent_term ) ) |
|
1909 | return new IXR_Error( 500, $parent_term->get_error_message() ); |
|
1910 | ||
1911 | if ( ! $parent_term ) |
|
1912 | return new IXR_Error( 403, __( 'Parent term does not exist.' ) ); |
|
1913 | ||
1914 | $term_data['parent'] = $content_struct['parent']; |
|
1915 | } |
|
1916 | ||
1917 | if ( isset( $content_struct['description'] ) ) |
|
1918 | $term_data['description'] = $content_struct['description']; |
|
@@ 1999-2013 (lines=15) @@ | ||
1996 | return new IXR_Error( 403, __( 'The term name cannot be empty.' ) ); |
|
1997 | } |
|
1998 | ||
1999 | if ( ! empty( $content_struct['parent'] ) ) { |
|
2000 | if ( ! $taxonomy['hierarchical'] ) |
|
2001 | return new IXR_Error( 403, __( "This taxonomy is not hierarchical so you can't set a parent." ) ); |
|
2002 | ||
2003 | $parent_term_id = (int) $content_struct['parent']; |
|
2004 | $parent_term = get_term( $parent_term_id , $taxonomy['name'] ); |
|
2005 | ||
2006 | if ( is_wp_error( $parent_term ) ) |
|
2007 | return new IXR_Error( 500, $parent_term->get_error_message() ); |
|
2008 | ||
2009 | if ( ! $parent_term ) |
|
2010 | return new IXR_Error( 403, __( 'Parent term does not exist.' ) ); |
|
2011 | ||
2012 | $term_data['parent'] = $content_struct['parent']; |
|
2013 | } |
|
2014 | ||
2015 | if ( isset( $content_struct['description'] ) ) |
|
2016 | $term_data['description'] = $content_struct['description']; |