55}
66
77class BEA_CSF_Cli_Helper {
8+
89 /**
9- *
1010 * Synchronization all terms from any taxonomies
1111 *
1212 * @param array $args
1313 * @param array $terms_args
1414 *
15- * @return bool
15+ * @return array| bool
1616 */
1717 public static function get_all_terms ( $ args = array (), $ terms_args = array () ) {
1818 $ args = wp_parse_args ( $ args , array () );
@@ -26,8 +26,15 @@ public static function get_all_terms( $args = array(), $terms_args = array() ) {
2626 }
2727
2828 // Get terms objects
29- $ terms_args = wp_parse_args ( $ terms_args , array ( 'hide_empty ' => false ) );
30- $ results = get_terms ( array_keys ( $ taxonomies ), $ terms_args );
29+ $ terms_args = wp_parse_args (
30+ $ terms_args ,
31+ array (
32+ 'taxonomy ' => array_keys ( $ taxonomies ),
33+ 'hide_empty ' => false ,
34+ 'orderby ' => 'term_id ' ,
35+ )
36+ );
37+ $ results = get_terms ( $ terms_args );
3138 if ( is_wp_error ( $ results ) || empty ( $ results ) ) {
3239 WP_CLI ::debug ( 'No terms found for taxonomies : %s ' , implode ( ', ' , array_keys ( $ taxonomies ) ) );
3340
@@ -38,18 +45,24 @@ public static function get_all_terms( $args = array(), $terms_args = array() ) {
3845 }
3946
4047 /**
41- *
4248 * Synchronization all terms from any taxonomies
4349 *
4450 * @param array $taxonomies
4551 * @param array $terms_args
4652 *
47- * @return bool
53+ * @return array| bool
4854 */
4955 public static function get_terms ( $ taxonomies = array (), $ terms_args = array () ) {
5056 // Get terms objects
51- $ terms_args = wp_parse_args ( $ terms_args , array ( 'hide_empty ' => false ) );
52- $ results = get_terms ( $ taxonomies , $ terms_args );
57+ $ terms_args = wp_parse_args (
58+ $ terms_args ,
59+ array (
60+ 'taxonomy ' => $ taxonomies ,
61+ 'hide_empty ' => false ,
62+ 'orderby ' => 'term_id ' ,
63+ )
64+ );
65+ $ results = get_terms ( $ terms_args );
5366 if ( is_wp_error ( $ results ) || empty ( $ results ) ) {
5467 WP_CLI ::debug ( 'No terms found for taxonomies : %s ' , implode ( ', ' , $ taxonomies ) );
5568
0 commit comments