get_edit_term_link example


        $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );

        $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );

        $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];

        $edit_link = get_edit_term_link( $tag$taxonomy$this->screen->post_type );

        if ( $edit_link ) {
            $edit_link = add_query_arg(
                'wp_http_referer',
                urlencode( wp_unslash( $uri ) ),
                $edit_link
            );
            $name      = sprintf(
                '<a class="row-title" href="%s" aria-label="%s">%s</a>',
                esc_url( $edit_link ),
                /* translators: %s: Taxonomy term name. */
                
if ( ! isset( $_REQUEST['tag_ID'] ) ) {
            break;
        }

        $term_id = (int) $_REQUEST['tag_ID'];
        $term    = get_term( $term_id );

        if ( ! $term instanceof WP_Term ) {
            wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
        }

        wp_redirect( sanitize_url( get_edit_term_link( $term_id$taxonomy$post_type ) ) );
        exit;

    case 'editedtag':
        $tag_ID = (int) $_POST['tag_ID'];
        check_admin_referer( 'update-tag_' . $tag_ID );

        if ( ! current_user_can( 'edit_term', $tag_ID ) ) {
            wp_die(
                '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
                403
            );
'order'   => 'DESC',
            )
        )
    ); // Always query top tags.
    if ( empty( $tags ) || is_wp_error( $tags ) ) {
        return;
    }

    foreach ( $tags as $key => $tag ) {
        if ( 'edit' === $args['link'] ) {
            $link = get_edit_term_link( $tag$tag->taxonomy, $args['post_type'] );
        } else {
            $link = get_term_link( $tag$tag->taxonomy );
        }

        if ( is_wp_error( $link ) ) {
            return;
        }

        $tags[ $key ]->link = $link;
        $tags[ $key ]->id   = $tag->term_id;
    }

    

function get_edit_tag_link( $tag$taxonomy = 'post_tag' ) {
    /** * Filters the edit link for a tag (or term in another taxonomy). * * @since 2.7.0 * * @param string $link The term edit link. */
    return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag$taxonomy ) );
}

/** * Displays or retrieves the edit link for a tag with formatting. * * @since 2.7.0 * * @param string $link Optional. Anchor text. If empty, default is 'Edit This'. Default empty. * @param string $before Optional. Display before edit link. Default empty. * @param string $after Optional. Display after edit link. Default empty. * @param WP_Term $tag Optional. Term object. If null, the queried object will be inspected. * Default null. */
&& $post_type_object->show_in_admin_bar ) {
                $wp_admin_bar->add_node(
                    array(
                        'id'    => 'edit',
                        'title' => $post_type_object->labels->edit_item,
                        'href'  => $edit_post_link,
                    )
                );
            }
        } elseif ( ! empty( $current_object->taxonomy ) ) {
            $tax            = get_taxonomy( $current_object->taxonomy );
            $edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy );
            if ( $tax && $edit_term_link && current_user_can( 'edit_term', $current_object->term_id ) ) {
                $wp_admin_bar->add_node(
                    array(
                        'id'    => 'edit',
                        'title' => $tax->labels->edit_item,
                        'href'  => $edit_term_link,
                    )
                );
            }
        } elseif ( is_a( $current_object, 'WP_User' ) && current_user_can( 'edit_user', $current_object->ID ) ) {
            $edit_user_link = get_edit_user_link( $current_object->ID );
            
Home | Imprint | This part of the site doesn't use cookies.