Changeset 15792
- Timestamp:
- 10/13/2010 02:54:21 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r15746 r15792 653 653 */ 654 654 function get_edit_tag_link( $tag_id = 0, $taxonomy = 'post_tag' ) { 655 global $post_type; 656 $tax = get_taxonomy($taxonomy); 657 if ( !current_user_can($tax->cap->edit_terms) ) 658 return; 659 660 $tag = get_term($tag_id, $taxonomy); 661 662 $location = admin_url('edit-tags.php?action=edit&taxonomy=' . $taxonomy . '&' . (!empty($post_type) ? 'post_type=' . $post_type .'&' : '') .'tag_ID=' . $tag->term_id); 663 return apply_filters( 'get_edit_tag_link', $location ); 655 return apply_filters( 'get_edit_tag_link', get_edit_term_url( $tag_id, $taxonomy ) ); 664 656 } 665 657 … … 673 665 * @param string $after Optional. Display after edit link. 674 666 * @param int|object $tag Tag object or ID 675 * @return string |null HTML content, if $echo is set to false.667 * @return string HTML content. 676 668 */ 677 669 function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) { 678 $tax = get_taxonomy('post_tag'); 670 $link = edit_term_link( $link, '', '', false, $tag ); 671 echo $before . apply_filters( 'edit_tag_link', $link ) . $after; 672 } 673 674 /** 675 * Retrieve edit term url. 676 * 677 * @since 3.1 678 * 679 * @param int $term_id Term ID 680 * @param int $taxonomy Taxonomy 681 * @return string 682 */ 683 function get_edit_term_url( $term_id = 0, $taxonomy = 'post_tag' ) { 684 $tax = get_taxonomy($taxonomy); 679 685 if ( !current_user_can($tax->cap->edit_terms) ) 680 686 return; 681 687 682 $tag = get_term($tag, 'post_tag'); 688 $term = get_term($term_id, $taxonomy); 689 690 $location = admin_url('edit-tags.php?action=edit&taxonomy=' . $taxonomy .'&tag_ID=' . $term->term_id); 691 692 return apply_filters( 'get_edit_term_url', $location ); 693 } 694 695 /** 696 * Display or retrieve edit term link with formatting. 697 * 698 * @since 3.1 699 * 700 * @param string $link Optional. Anchor text. 701 * @param string $before Optional. Display before edit link. 702 * @param string $after Optional. Display after edit link. 703 * @param object $term Term object 704 * @return string HTML content. 705 */ 706 function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) { 707 708 if ( $term == null ) { 709 global $wp_query; 710 $term = $wp_query->get_queried_object(); 711 } 712 713 $tax = get_taxonomy( $term->taxonomy ); 714 if ( !current_user_can($tax->cap->edit_terms) ) 715 return; 683 716 684 717 if ( empty($link) ) 685 718 $link = __('Edit This'); 686 719 687 $link = '<a href="' . get_edit_tag_link( $tag->term_id ) . '" title="' . __( 'Edit Tag' ) . '">' . $link . '</a>'; 688 echo $before . apply_filters( 'edit_tag_link', $link, $tag->term_id ) . $after; 720 $link = '<a href="' . get_edit_term_url( $term->term_id, $term->taxonomy ) . '" title="' . $link . '">' . $link . '</a>'; 721 $link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after; 722 723 if ( $echo ) 724 echo $link; 725 else 726 return $link; 689 727 } 690 728
Note: See TracChangeset
for help on using the changeset viewer.