Conditions | 120 |
Paths | 0 |
Total Lines | 513 |
Code Lines | 279 |
Lines | 18 |
Ratio | 3.51 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
307 | public function get_terms() { |
||
308 | global $wpdb; |
||
309 | |||
310 | $this->parse_query( $this->query_vars ); |
||
311 | $args = &$this->query_vars; |
||
312 | |||
313 | // Set up meta_query so it's available to 'pre_get_terms'. |
||
314 | $this->meta_query = new WP_Meta_Query(); |
||
315 | $this->meta_query->parse_query_vars( $args ); |
||
316 | |||
317 | /** |
||
318 | * Fires before terms are retrieved. |
||
319 | * |
||
320 | * @since 4.6.0 |
||
321 | * |
||
322 | * @param WP_Term_Query $this Current instance of WP_Term_Query. |
||
323 | */ |
||
324 | do_action( 'pre_get_terms', $this ); |
||
325 | |||
326 | $taxonomies = (array) $args['taxonomy']; |
||
327 | |||
328 | // Save queries by not crawling the tree in the case of multiple taxes or a flat tax. |
||
329 | $has_hierarchical_tax = false; |
||
330 | if ( $taxonomies ) { |
||
331 | foreach ( $taxonomies as $_tax ) { |
||
332 | if ( is_taxonomy_hierarchical( $_tax ) ) { |
||
333 | $has_hierarchical_tax = true; |
||
334 | } |
||
335 | } |
||
336 | } |
||
337 | |||
338 | if ( ! $has_hierarchical_tax ) { |
||
339 | $args['hierarchical'] = false; |
||
340 | $args['pad_counts'] = false; |
||
341 | } |
||
342 | |||
343 | // 'parent' overrides 'child_of'. |
||
344 | if ( 0 < intval( $args['parent'] ) ) { |
||
345 | $args['child_of'] = false; |
||
346 | } |
||
347 | |||
348 | View Code Duplication | if ( 'all' == $args['get'] ) { |
|
349 | $args['childless'] = false; |
||
350 | $args['child_of'] = 0; |
||
351 | $args['hide_empty'] = 0; |
||
352 | $args['hierarchical'] = false; |
||
353 | $args['pad_counts'] = false; |
||
354 | } |
||
355 | |||
356 | /** |
||
357 | * Filters the terms query arguments. |
||
358 | * |
||
359 | * @since 3.1.0 |
||
360 | * |
||
361 | * @param array $args An array of get_terms() arguments. |
||
362 | * @param array $taxonomies An array of taxonomies. |
||
363 | */ |
||
364 | $args = apply_filters( 'get_terms_args', $args, $taxonomies ); |
||
365 | |||
366 | // Avoid the query if the queried parent/child_of term has no descendants. |
||
367 | $child_of = $args['child_of']; |
||
368 | $parent = $args['parent']; |
||
369 | |||
370 | if ( $child_of ) { |
||
371 | $_parent = $child_of; |
||
372 | } elseif ( $parent ) { |
||
373 | $_parent = $parent; |
||
374 | } else { |
||
375 | $_parent = false; |
||
376 | } |
||
377 | |||
378 | if ( $_parent ) { |
||
379 | $in_hierarchy = false; |
||
380 | foreach ( $taxonomies as $_tax ) { |
||
381 | $hierarchy = _get_term_hierarchy( $_tax ); |
||
382 | |||
383 | if ( isset( $hierarchy[ $_parent ] ) ) { |
||
384 | $in_hierarchy = true; |
||
385 | } |
||
386 | } |
||
387 | |||
388 | if ( ! $in_hierarchy ) { |
||
389 | return array(); |
||
390 | } |
||
391 | } |
||
392 | |||
393 | // 'term_order' is a legal sort order only when joining the relationship table. |
||
394 | $_orderby = $this->query_vars['orderby']; |
||
395 | if ( 'term_order' === $_orderby && empty( $this->query_vars['object_ids'] ) ) { |
||
396 | $_orderby = 'term_id'; |
||
397 | } |
||
398 | $orderby = $this->parse_orderby( $_orderby ); |
||
399 | |||
400 | if ( $orderby ) { |
||
401 | $orderby = "ORDER BY $orderby"; |
||
402 | } |
||
403 | |||
404 | $order = $this->parse_order( $this->query_vars['order'] ); |
||
405 | |||
406 | if ( $taxonomies ) { |
||
407 | $this->sql_clauses['where']['taxonomy'] = "tt.taxonomy IN ('" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "')"; |
||
408 | } |
||
409 | |||
410 | $exclude = $args['exclude']; |
||
411 | $exclude_tree = $args['exclude_tree']; |
||
412 | $include = $args['include']; |
||
413 | |||
414 | $inclusions = ''; |
||
415 | if ( ! empty( $include ) ) { |
||
416 | $exclude = ''; |
||
417 | $exclude_tree = ''; |
||
418 | $inclusions = implode( ',', wp_parse_id_list( $include ) ); |
||
419 | } |
||
420 | |||
421 | if ( ! empty( $inclusions ) ) { |
||
422 | $this->sql_clauses['where']['inclusions'] = 't.term_id IN ( ' . $inclusions . ' )'; |
||
423 | } |
||
424 | |||
425 | $exclusions = array(); |
||
426 | if ( ! empty( $exclude_tree ) ) { |
||
427 | $exclude_tree = wp_parse_id_list( $exclude_tree ); |
||
428 | $excluded_children = $exclude_tree; |
||
429 | foreach ( $exclude_tree as $extrunk ) { |
||
430 | $excluded_children = array_merge( |
||
431 | $excluded_children, |
||
432 | (array) get_terms( $taxonomies[0], array( |
||
433 | 'child_of' => intval( $extrunk ), |
||
434 | 'fields' => 'ids', |
||
435 | 'hide_empty' => 0 |
||
436 | ) ) |
||
437 | ); |
||
438 | } |
||
439 | $exclusions = array_merge( $excluded_children, $exclusions ); |
||
440 | } |
||
441 | |||
442 | if ( ! empty( $exclude ) ) { |
||
443 | $exclusions = array_merge( wp_parse_id_list( $exclude ), $exclusions ); |
||
444 | } |
||
445 | |||
446 | // 'childless' terms are those without an entry in the flattened term hierarchy. |
||
447 | $childless = (bool) $args['childless']; |
||
448 | if ( $childless ) { |
||
449 | foreach ( $taxonomies as $_tax ) { |
||
450 | $term_hierarchy = _get_term_hierarchy( $_tax ); |
||
451 | $exclusions = array_merge( array_keys( $term_hierarchy ), $exclusions ); |
||
452 | } |
||
453 | } |
||
454 | |||
455 | if ( ! empty( $exclusions ) ) { |
||
456 | $exclusions = 't.term_id NOT IN (' . implode( ',', array_map( 'intval', $exclusions ) ) . ')'; |
||
457 | } else { |
||
458 | $exclusions = ''; |
||
459 | } |
||
460 | |||
461 | /** |
||
462 | * Filters the terms to exclude from the terms query. |
||
463 | * |
||
464 | * @since 2.3.0 |
||
465 | * |
||
466 | * @param string $exclusions `NOT IN` clause of the terms query. |
||
467 | * @param array $args An array of terms query arguments. |
||
468 | * @param array $taxonomies An array of taxonomies. |
||
469 | */ |
||
470 | $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies ); |
||
471 | |||
472 | if ( ! empty( $exclusions ) ) { |
||
473 | // Must do string manipulation here for backward compatibility with filter. |
||
474 | $this->sql_clauses['where']['exclusions'] = preg_replace( '/^\s*AND\s*/', '', $exclusions ); |
||
475 | } |
||
476 | |||
477 | if ( |
||
478 | ( ! empty( $args['name'] ) ) || |
||
479 | ( is_string( $args['name'] ) && 0 !== strlen( $args['name'] ) ) |
||
480 | ) { |
||
481 | $names = (array) $args['name']; |
||
482 | foreach ( $names as &$_name ) { |
||
483 | // `sanitize_term_field()` returns slashed data. |
||
484 | $_name = stripslashes( sanitize_term_field( 'name', $_name, 0, reset( $taxonomies ), 'db' ) ); |
||
485 | } |
||
486 | |||
487 | $this->sql_clauses['where']['name'] = "t.name IN ('" . implode( "', '", array_map( 'esc_sql', $names ) ) . "')"; |
||
488 | } |
||
489 | |||
490 | if ( |
||
491 | ( ! empty( $args['slug'] ) ) || |
||
492 | ( is_string( $args['slug'] ) && 0 !== strlen( $args['slug'] ) ) |
||
493 | ) { |
||
494 | if ( is_array( $args['slug'] ) ) { |
||
495 | $slug = array_map( 'sanitize_title', $args['slug'] ); |
||
496 | $this->sql_clauses['where']['slug'] = "t.slug IN ('" . implode( "', '", $slug ) . "')"; |
||
497 | } else { |
||
498 | $slug = sanitize_title( $args['slug'] ); |
||
499 | $this->sql_clauses['where']['slug'] = "t.slug = '$slug'"; |
||
500 | } |
||
501 | } |
||
502 | |||
503 | if ( ! empty( $args['term_taxonomy_id'] ) ) { |
||
504 | if ( is_array( $args['term_taxonomy_id'] ) ) { |
||
505 | $tt_ids = implode( ',', array_map( 'intval', $args['term_taxonomy_id'] ) ); |
||
506 | $this->sql_clauses['where']['term_taxonomy_id'] = "tt.term_taxonomy_id IN ({$tt_ids})"; |
||
507 | } else { |
||
508 | $this->sql_clauses['where']['term_taxonomy_id'] = $wpdb->prepare( "tt.term_taxonomy_id = %d", $args['term_taxonomy_id'] ); |
||
509 | } |
||
510 | } |
||
511 | |||
512 | View Code Duplication | if ( ! empty( $args['name__like'] ) ) { |
|
513 | $this->sql_clauses['where']['name__like'] = $wpdb->prepare( "t.name LIKE %s", '%' . $wpdb->esc_like( $args['name__like'] ) . '%' ); |
||
514 | } |
||
515 | |||
516 | View Code Duplication | if ( ! empty( $args['description__like'] ) ) { |
|
517 | $this->sql_clauses['where']['description__like'] = $wpdb->prepare( "tt.description LIKE %s", '%' . $wpdb->esc_like( $args['description__like'] ) . '%' ); |
||
518 | } |
||
519 | |||
520 | if ( ! empty( $args['object_ids'] ) ) { |
||
521 | $object_ids = $args['object_ids']; |
||
522 | if ( ! is_array( $object_ids ) ) { |
||
523 | $object_ids = array( $object_ids ); |
||
524 | } |
||
525 | |||
526 | $object_ids = implode( ', ', array_map( 'intval', $object_ids ) ); |
||
527 | $this->sql_clauses['where']['object_ids'] = "tr.object_id IN ($object_ids)"; |
||
528 | } |
||
529 | |||
530 | /* |
||
531 | * When querying for object relationships, the 'count > 0' check |
||
532 | * added by 'hide_empty' is superfluous. |
||
533 | */ |
||
534 | if ( ! empty( $args['object_ids'] ) ) { |
||
535 | $args['hide_empty'] = false; |
||
536 | } |
||
537 | |||
538 | if ( '' !== $parent ) { |
||
539 | $parent = (int) $parent; |
||
540 | $this->sql_clauses['where']['parent'] = "tt.parent = '$parent'"; |
||
541 | } |
||
542 | |||
543 | $hierarchical = $args['hierarchical']; |
||
544 | if ( 'count' == $args['fields'] ) { |
||
545 | $hierarchical = false; |
||
546 | } |
||
547 | if ( $args['hide_empty'] && !$hierarchical ) { |
||
548 | $this->sql_clauses['where']['count'] = 'tt.count > 0'; |
||
549 | } |
||
550 | |||
551 | $number = $args['number']; |
||
552 | $offset = $args['offset']; |
||
553 | |||
554 | // Don't limit the query results when we have to descend the family tree. |
||
555 | if ( $number && ! $hierarchical && ! $child_of && '' === $parent ) { |
||
556 | View Code Duplication | if ( $offset ) { |
|
557 | $limits = 'LIMIT ' . $offset . ',' . $number; |
||
558 | } else { |
||
559 | $limits = 'LIMIT ' . $number; |
||
560 | } |
||
561 | } else { |
||
562 | $limits = ''; |
||
563 | } |
||
564 | |||
565 | |||
566 | if ( ! empty( $args['search'] ) ) { |
||
567 | $this->sql_clauses['where']['search'] = $this->get_search_sql( $args['search'] ); |
||
568 | } |
||
569 | |||
570 | // Meta query support. |
||
571 | $join = ''; |
||
572 | $distinct = ''; |
||
573 | |||
574 | // Reparse meta_query query_vars, in case they were modified in a 'pre_get_terms' callback. |
||
575 | $this->meta_query->parse_query_vars( $this->query_vars ); |
||
576 | $mq_sql = $this->meta_query->get_sql( 'term', 't', 'term_id' ); |
||
577 | $meta_clauses = $this->meta_query->get_clauses(); |
||
578 | |||
579 | if ( ! empty( $meta_clauses ) ) { |
||
580 | $join .= $mq_sql['join']; |
||
581 | $this->sql_clauses['where']['meta_query'] = preg_replace( '/^\s*AND\s*/', '', $mq_sql['where'] ); |
||
582 | $distinct .= "DISTINCT"; |
||
583 | |||
584 | } |
||
585 | |||
586 | $selects = array(); |
||
587 | switch ( $args['fields'] ) { |
||
588 | case 'all': |
||
589 | case 'all_with_object_id' : |
||
590 | case 'tt_ids' : |
||
591 | case 'slugs' : |
||
592 | $selects = array( 't.*', 'tt.*' ); |
||
593 | if ( 'all_with_object_id' === $args['fields'] && ! empty( $args['object_ids'] ) ) { |
||
594 | $selects[] = 'tr.object_id'; |
||
595 | } |
||
596 | break; |
||
597 | case 'ids': |
||
598 | case 'id=>parent': |
||
599 | $selects = array( 't.term_id', 'tt.parent', 'tt.count', 'tt.taxonomy' ); |
||
600 | break; |
||
601 | case 'names': |
||
602 | $selects = array( 't.term_id', 'tt.parent', 'tt.count', 't.name', 'tt.taxonomy' ); |
||
603 | break; |
||
604 | case 'count': |
||
605 | $orderby = ''; |
||
606 | $order = ''; |
||
607 | $selects = array( 'COUNT(*)' ); |
||
608 | break; |
||
609 | case 'id=>name': |
||
610 | $selects = array( 't.term_id', 't.name', 'tt.count', 'tt.taxonomy' ); |
||
611 | break; |
||
612 | case 'id=>slug': |
||
613 | $selects = array( 't.term_id', 't.slug', 'tt.count', 'tt.taxonomy' ); |
||
614 | break; |
||
615 | } |
||
616 | |||
617 | $_fields = $args['fields']; |
||
618 | |||
619 | /** |
||
620 | * Filters the fields to select in the terms query. |
||
621 | * |
||
622 | * Field lists modified using this filter will only modify the term fields returned |
||
623 | * by the function when the `$fields` parameter set to 'count' or 'all'. In all other |
||
624 | * cases, the term fields in the results array will be determined by the `$fields` |
||
625 | * parameter alone. |
||
626 | * |
||
627 | * Use of this filter can result in unpredictable behavior, and is not recommended. |
||
628 | * |
||
629 | * @since 2.8.0 |
||
630 | * |
||
631 | * @param array $selects An array of fields to select for the terms query. |
||
632 | * @param array $args An array of term query arguments. |
||
633 | * @param array $taxonomies An array of taxonomies. |
||
634 | */ |
||
635 | $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies ) ); |
||
636 | |||
637 | $join .= " INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id"; |
||
638 | |||
639 | if ( ! empty( $this->query_vars['object_ids'] ) ) { |
||
640 | $join .= " INNER JOIN {$wpdb->term_relationships} AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id"; |
||
641 | } |
||
642 | |||
643 | $where = implode( ' AND ', $this->sql_clauses['where'] ); |
||
644 | |||
645 | /** |
||
646 | * Filters the terms query SQL clauses. |
||
647 | * |
||
648 | * @since 3.1.0 |
||
649 | * |
||
650 | * @param array $pieces Terms query SQL clauses. |
||
651 | * @param array $taxonomies An array of taxonomies. |
||
652 | * @param array $args An array of terms query arguments. |
||
653 | */ |
||
654 | $clauses = apply_filters( 'terms_clauses', compact( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' ), $taxonomies, $args ); |
||
655 | |||
656 | $fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : ''; |
||
657 | $join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : ''; |
||
658 | $where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : ''; |
||
659 | $distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : ''; |
||
660 | $orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : ''; |
||
661 | $order = isset( $clauses[ 'order' ] ) ? $clauses[ 'order' ] : ''; |
||
662 | $limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : ''; |
||
663 | |||
664 | if ( $where ) { |
||
665 | $where = "WHERE $where"; |
||
666 | } |
||
667 | |||
668 | $this->sql_clauses['select'] = "SELECT $distinct $fields"; |
||
669 | $this->sql_clauses['from'] = "FROM $wpdb->terms AS t $join"; |
||
670 | $this->sql_clauses['orderby'] = $orderby ? "$orderby $order" : ''; |
||
671 | $this->sql_clauses['limits'] = $limits; |
||
672 | |||
673 | $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}"; |
||
674 | |||
675 | // $args can be anything. Only use the args defined in defaults to compute the key. |
||
676 | $key = md5( serialize( wp_array_slice_assoc( $args, array_keys( $this->query_var_defaults ) ) ) . serialize( $taxonomies ) . $this->request ); |
||
677 | $last_changed = wp_cache_get_last_changed( 'terms' ); |
||
678 | $cache_key = "get_terms:$key:$last_changed"; |
||
679 | $cache = wp_cache_get( $cache_key, 'terms' ); |
||
680 | if ( false !== $cache ) { |
||
681 | if ( 'all' === $_fields ) { |
||
682 | $cache = array_map( 'get_term', $cache ); |
||
683 | } |
||
684 | |||
685 | $this->terms = $cache; |
||
686 | return $this->terms; |
||
687 | } |
||
688 | |||
689 | if ( 'count' == $_fields ) { |
||
690 | $count = $wpdb->get_var( $this->request ); |
||
691 | wp_cache_set( $cache_key, $count, 'terms' ); |
||
692 | return $count; |
||
693 | } |
||
694 | |||
695 | $terms = $wpdb->get_results( $this->request ); |
||
696 | if ( 'all' == $_fields || 'all_with_object_id' === $_fields ) { |
||
697 | update_term_cache( $terms ); |
||
698 | } |
||
699 | |||
700 | // Prime termmeta cache. |
||
701 | if ( $args['update_term_meta_cache'] ) { |
||
702 | $term_ids = wp_list_pluck( $terms, 'term_id' ); |
||
703 | update_termmeta_cache( $term_ids ); |
||
704 | } |
||
705 | |||
706 | if ( empty( $terms ) ) { |
||
707 | wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); |
||
708 | return array(); |
||
709 | } |
||
710 | |||
711 | if ( $child_of ) { |
||
712 | foreach ( $taxonomies as $_tax ) { |
||
713 | $children = _get_term_hierarchy( $_tax ); |
||
714 | if ( ! empty( $children ) ) { |
||
715 | $terms = _get_term_children( $child_of, $terms, $_tax ); |
||
716 | } |
||
717 | } |
||
718 | } |
||
719 | |||
720 | // Update term counts to include children. |
||
721 | if ( $args['pad_counts'] && 'all' == $_fields ) { |
||
722 | foreach ( $taxonomies as $_tax ) { |
||
723 | _pad_term_counts( $terms, $_tax ); |
||
724 | } |
||
725 | } |
||
726 | |||
727 | // Make sure we show empty categories that have children. |
||
728 | if ( $hierarchical && $args['hide_empty'] && is_array( $terms ) ) { |
||
729 | foreach ( $terms as $k => $term ) { |
||
730 | if ( ! $term->count ) { |
||
731 | $children = get_term_children( $term->term_id, $term->taxonomy ); |
||
732 | if ( is_array( $children ) ) { |
||
733 | foreach ( $children as $child_id ) { |
||
734 | $child = get_term( $child_id, $term->taxonomy ); |
||
735 | if ( $child->count ) { |
||
736 | continue 2; |
||
737 | } |
||
738 | } |
||
739 | } |
||
740 | |||
741 | // It really is empty. |
||
742 | unset( $terms[ $k ] ); |
||
743 | } |
||
744 | } |
||
745 | } |
||
746 | |||
747 | /* |
||
748 | * When querying for terms connected to objects, we may get |
||
749 | * duplicate results. The duplicates should be preserved if |
||
750 | * `$fields` is 'all_with_object_id', but should otherwise be |
||
751 | * removed. |
||
752 | */ |
||
753 | if ( ! empty( $args['object_ids'] ) && 'all_with_object_id' != $_fields ) { |
||
754 | $_tt_ids = $_terms = array(); |
||
755 | foreach ( $terms as $term ) { |
||
756 | if ( isset( $_tt_ids[ $term->term_id ] ) ) { |
||
757 | continue; |
||
758 | } |
||
759 | |||
760 | $_tt_ids[ $term->term_id ] = 1; |
||
761 | $_terms[] = $term; |
||
762 | } |
||
763 | |||
764 | $terms = $_terms; |
||
765 | } |
||
766 | |||
767 | $_terms = array(); |
||
768 | if ( 'id=>parent' == $_fields ) { |
||
769 | foreach ( $terms as $term ) { |
||
770 | $_terms[ $term->term_id ] = $term->parent; |
||
771 | } |
||
772 | } elseif ( 'ids' == $_fields ) { |
||
773 | foreach ( $terms as $term ) { |
||
774 | $_terms[] = (int) $term->term_id; |
||
775 | } |
||
776 | } elseif ( 'tt_ids' == $_fields ) { |
||
777 | foreach ( $terms as $term ) { |
||
778 | $_terms[] = (int) $term->term_taxonomy_id; |
||
779 | } |
||
780 | } elseif ( 'names' == $_fields ) { |
||
781 | foreach ( $terms as $term ) { |
||
782 | $_terms[] = $term->name; |
||
783 | } |
||
784 | } elseif ( 'slugs' == $_fields ) { |
||
785 | foreach ( $terms as $term ) { |
||
786 | $_terms[] = $term->slug; |
||
787 | } |
||
788 | } elseif ( 'id=>name' == $_fields ) { |
||
789 | foreach ( $terms as $term ) { |
||
790 | $_terms[ $term->term_id ] = $term->name; |
||
791 | } |
||
792 | } elseif ( 'id=>slug' == $_fields ) { |
||
793 | foreach ( $terms as $term ) { |
||
794 | $_terms[ $term->term_id ] = $term->slug; |
||
795 | } |
||
796 | } |
||
797 | |||
798 | if ( ! empty( $_terms ) ) { |
||
799 | $terms = $_terms; |
||
800 | } |
||
801 | |||
802 | // Hierarchical queries are not limited, so 'offset' and 'number' must be handled now. |
||
803 | if ( $hierarchical && $number && is_array( $terms ) ) { |
||
804 | if ( $offset >= count( $terms ) ) { |
||
805 | $terms = array(); |
||
806 | } else { |
||
807 | $terms = array_slice( $terms, $offset, $number, true ); |
||
808 | } |
||
809 | } |
||
810 | |||
811 | wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); |
||
812 | |||
813 | if ( 'all' === $_fields || 'all_with_object_id' === $_fields ) { |
||
814 | $terms = array_map( 'get_term', $terms ); |
||
815 | } |
||
816 | |||
817 | $this->terms = $terms; |
||
818 | return $this->terms; |
||
819 | } |
||
820 | |||
978 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..