Create a Custom Edit Template Link May 28, 2023 by Riston Leave a Comment Continuing my recent dive into customizing and adding functionality to my series of custom taxonomies, I realized that I need to be able to access the edit page for editing these specific archive pages. WordPress has a built-in function for accessing links to the post page, edit_post_link, but this does not work with taxonomy pages. WordPress didn’t initially implement taxonomies to operate as posts, and while I’m not using taxonomies necessarily as posts, I do include a great deal of data with my custom taxonomies that requires updates. Here is a basic function I wrote that builds a link for accessing the taxonomy’s edit page: // Accepts the relevant WP Term Object as the sole parameter function edit_template_link($term){ if(!current_user_can('administrator')){ return; } // Define the three variables required to build the link $taxonomy = $term->taxonomy; $id = $term->term_id; $root = get_bloginfo('url'); // Build the link $link = $root."/wp-admin/term.php?taxonomy=".$taxonomy."&tag_ID=".$id.""; // Build and return the HTML element $html = '<div class="edit-term-link">'; $html .= '<a href="'.$link.'" >Edit</a>'; $html .= '</div>'; return $html; }