| | 612 | * Retrieve edit category link. |
| | 613 | * |
| | 614 | * @since 3.0.0 |
| | 615 | * |
| | 616 | * @param int $category_id Category ID |
| | 617 | * @return string |
| | 618 | */ |
| | 619 | function get_edit_category_link( $category_id = 0, $taxonomy = 'category' ) { |
| | 620 | $category = get_term($category_id, $taxonomy); |
| | 621 | |
| | 622 | if ( !current_user_can('manage_categories') ) |
| | 623 | return; |
| | 624 | |
| | 625 | $location = admin_url('categories.php?action=edit&taxonomy=' . $taxonomy . '&cat_ID=' . $category->term_id); |
| | 626 | return apply_filters( 'get_edit_category_link', $location ); |
| | 627 | } |
| | 628 | |
| | 629 | /** |
| | 630 | * Display or retrieve edit category link with formatting. |
| | 631 | * |
| | 632 | * @since 3.0.0 |
| | 633 | * |
| | 634 | * @param string $link Optional. Anchor text. |
| | 635 | * @param string $before Optional. Display before edit link. |
| | 636 | * @param string $after Optional. Display after edit link. |
| | 637 | * @param int|object $category Tag object or ID |
| | 638 | * @return string|null HTML content, if $echo is set to false. |
| | 639 | */ |
| | 640 | function edit_category_link( $link = '', $before = '', $after = '', $category = null ) { |
| | 641 | $category = get_term($category, 'category'); |
| | 642 | |
| | 643 | if ( !current_user_can('manage_categories') ) |
| | 644 | return; |
| | 645 | |
| | 646 | if ( empty($link) ) |
| | 647 | $link = __('Edit This'); |
| | 648 | |
| | 649 | $link = '<a href="' . get_edit_category_link( $category->term_id ) . '" title="' . __( 'Edit tag' ) . '">' . $link . '</a>'; |
| | 650 | echo $before . apply_filters( 'edit_category_link', $link, $category->term_id ) . $after; |
| | 651 | } |
| | 652 | |
| | 653 | /** |