| @@ 519-532 (lines=14) @@ | ||
| 516 | if ( empty( $post ) && isset( $GLOBALS['post'] ) ) |
|
| 517 | $post = $GLOBALS['post']; |
|
| 518 | ||
| 519 | if ( $post instanceof WP_Post ) { |
|
| 520 | $_post = $post; |
|
| 521 | } elseif ( is_object( $post ) ) { |
|
| 522 | if ( empty( $post->filter ) ) { |
|
| 523 | $_post = sanitize_post( $post, 'raw' ); |
|
| 524 | $_post = new WP_Post( $_post ); |
|
| 525 | } elseif ( 'raw' == $post->filter ) { |
|
| 526 | $_post = new WP_Post( $post ); |
|
| 527 | } else { |
|
| 528 | $_post = WP_Post::get_instance( $post->ID ); |
|
| 529 | } |
|
| 530 | } else { |
|
| 531 | $_post = WP_Post::get_instance( $post ); |
|
| 532 | } |
|
| 533 | ||
| 534 | if ( ! $_post ) |
|
| 535 | return null; |
|
| @@ 733-744 (lines=12) @@ | ||
| 730 | return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); |
|
| 731 | } |
|
| 732 | ||
| 733 | if ( $term instanceof WP_Term ) { |
|
| 734 | $_term = $term; |
|
| 735 | } elseif ( is_object( $term ) ) { |
|
| 736 | if ( empty( $term->filter ) || 'raw' === $term->filter ) { |
|
| 737 | $_term = sanitize_term( $term, $taxonomy, 'raw' ); |
|
| 738 | $_term = new WP_Term( $_term ); |
|
| 739 | } else { |
|
| 740 | $_term = WP_Term::get_instance( $term->term_id ); |
|
| 741 | } |
|
| 742 | } else { |
|
| 743 | $_term = WP_Term::get_instance( $term, $taxonomy ); |
|
| 744 | } |
|
| 745 | ||
| 746 | if ( is_wp_error( $_term ) ) { |
|
| 747 | return $_term; |
|