Title: get_edit_term_link
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_edit_term_link( int|WP_Term|object $term, string $taxonomy, string $object_type ): string|null

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#wp--skip-link--target)

Retrieves the URL for editing a given term.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#parameters)󠁿

 `$term`int|[WP_Term](https://developer.wordpress.org/reference/classes/wp_term/)
|objectrequired

The ID or term object whose edit link will be retrieved.

`$taxonomy`stringoptional

Taxonomy. Defaults to the taxonomy of the term identified by `$term`.

`$object_type`stringoptional

The object type. Used to highlight the proper post type menu on the linked page.
Defaults to the first object_type associated with the taxonomy.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#return)󠁿

 string|null The edit term link URL for the given term, or null on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#source)󠁿

    ```php
    function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) {
    	$term = get_term( $term, $taxonomy );
    	if ( ! $term || is_wp_error( $term ) ) {
    		return;
    	}

    	$tax     = get_taxonomy( $term->taxonomy );
    	$term_id = $term->term_id;
    	if ( ! $tax || ! current_user_can( 'edit_term', $term_id ) ) {
    		return;
    	}

    	$args = array(
    		'taxonomy' => $tax->name,
    		'tag_ID'   => $term_id,
    	);

    	if ( $object_type ) {
    		$args['post_type'] = $object_type;
    	} elseif ( ! empty( $tax->object_type ) ) {
    		$args['post_type'] = reset( $tax->object_type );
    	}

    	if ( $tax->show_ui ) {
    		$location = add_query_arg( $args, admin_url( 'term.php' ) );
    	} else {
    		$location = '';
    	}

    	/**
    	 * Filters the edit link for a term.
    	 *
    	 * @since 3.1.0
    	 *
    	 * @param string $location    The edit link.
    	 * @param int    $term_id     Term ID.
    	 * @param string $taxonomy    Taxonomy name.
    	 * @param string $object_type The object type.
    	 */
    	return apply_filters( 'get_edit_term_link', $location, $term_id, $taxonomy, $object_type );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/link-template.php#L1082)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/link-template.php#L1082-L1122)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#hooks)󠁿

 [apply_filters( ‘get_edit_term_link’, string $location, int $term_id, string $taxonomy, string $object_type )](https://developer.wordpress.org/reference/hooks/get_edit_term_link/)

Filters the edit link for a term.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#related)󠁿

| Uses | Description | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [add_query_arg()](https://developer.wordpress.org/reference/functions/add_query_arg/)`wp-includes/functions.php` |

Retrieves a modified URL query string.

  | 
| [get_term()](https://developer.wordpress.org/reference/functions/get_term/)`wp-includes/taxonomy.php` |

Gets all term data from database by term ID.

  | 
| [get_taxonomy()](https://developer.wordpress.org/reference/functions/get_taxonomy/)`wp-includes/taxonomy.php` |

Retrieves the taxonomy object of $taxonomy.

  | 
| [admin_url()](https://developer.wordpress.org/reference/functions/admin_url/)`wp-includes/link-template.php` |

Retrieves the URL to the admin area for the current site.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  |

[Show 5 more](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#)

| Used by | Description | 
| [WP_Terms_List_Table::handle_row_actions()](https://developer.wordpress.org/reference/classes/wp_terms_list_table/handle_row_actions/)`wp-admin/includes/class-wp-terms-list-table.php` |

Generates and displays row action links.

  | 
| [WP_Terms_List_Table::column_name()](https://developer.wordpress.org/reference/classes/wp_terms_list_table/column_name/)`wp-admin/includes/class-wp-terms-list-table.php` |  | 
| [wp_tag_cloud()](https://developer.wordpress.org/reference/functions/wp_tag_cloud/)`wp-includes/category-template.php` |

Displays a tag cloud.

  | 
| [get_edit_tag_link()](https://developer.wordpress.org/reference/functions/get_edit_tag_link/)`wp-includes/link-template.php` |

Retrieves the edit link for a tag.

  | 
| [edit_term_link()](https://developer.wordpress.org/reference/functions/edit_term_link/)`wp-includes/link-template.php` |

Displays or retrieves the edit term link with formatting.

  | 
| [wp_admin_bar_edit_menu()](https://developer.wordpress.org/reference/functions/wp_admin_bar_edit_menu/)`wp-includes/admin-bar.php` |

Provides an edit link for posts and terms.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | The `$taxonomy` parameter was made optional. | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#comment-content-1498)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/get_edit_term_link/#comment-1498)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_edit_term_link%2F%23comment-1498)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_edit_term_link%2F%23comment-1498)
 4.  **Get term’s link to edit**
 5.      ```php
         $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) );
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_edit_term_link%2F%3Freplytocom%3D1498%23feedback-editor-1498)
 7.   [Skip to note 5 content](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#comment-content-3541)
 8.    [Steven Lin](https://profiles.wordpress.org/stevenlinx/)  [  6 years ago  ](https://developer.wordpress.org/reference/functions/get_edit_term_link/#comment-3541)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_edit_term_link%2F%23comment-3541)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_edit_term_link%2F%23comment-3541)
 10. Example from the legacy Codex:
 11. Using `get_edit_tag_link()` may be a better choice in most situations as it will
     apply the ‘`get_edit_tag_link`‘ filter, which may be implemented by plugins and
     themes.
 12.     ```php
         function get_edit_tag_link( $tag_id, $taxonomy = 'post_tag' ) {
         	return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag_id, $taxonomy ) );
         }
         ```
     
 13.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_edit_term_link%2F%3Freplytocom%3D3541%23feedback-editor-3541)
 14.  [Skip to note 6 content](https://developer.wordpress.org/reference/functions/get_edit_term_link/?output_format=md#comment-content-7192)
 15.   [Pt](https://profiles.wordpress.org/bncpeter/)  [  1 year ago  ](https://developer.wordpress.org/reference/functions/get_edit_term_link/#comment-7192)
 16. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_edit_term_link%2F%23comment-7192)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_edit_term_link%2F%23comment-7192)
 17. Note that even though the `$taxonomy` argument is optional, the URL returned will
     omit it if you choose not to use it, rather than properly getting it from the 
     term object:
 18.     ```php
         $term = WP Term Object;
     
         echo get_edit_term_link($term);
         https://{domain}/wp-admin/term.php?taxonomy&tag_ID={term_id}&post_type={post_type}
         ```
     
 19.  * This can have unexpected side-effects like ACF fields associated with the taxonomy
        not being shown.
 20.     ```php
         echo get_edit_term_link($term, 'taxonomy');
         https://{domain}/wp-admin/term.php?taxonomy={taxonomy}&tag_ID={term_id}&post_type={post_type}
         ```
     
 21.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_edit_term_link%2F%3Freplytocom%3D7192%23feedback-editor-7192)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_edit_term_link%2F)
before being able to contribute a note or feedback.