Lyrici Triade

Lyrici Triade

Music, Software, Philosophy

  • About
  • Writings
    • Software Development
    • Technology
    • Music
    • Music Technology
    • Mythology
    • Art & Design
  • Guides
    • UI
  • Contact

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;

}

Filed Under: Code Snippet, Technology

Leave a Reply Cancel reply

You must be logged in to post a comment.

Search

Tags

Adobe Illusrator Adobe XD audience Behavioral ChucK Cognitive Color Theory Composition Creative Computing Deep Learning Design DSP Foxes Music Technology Neural Network Prototype Sound Design Spoof Album Covers Synthesis UI user research UX Vulpes

Categories

  • Art & Design
  • Code Snippet
  • Guides
  • Learning Technique
  • Machine Learning
  • Music
  • Music Technology
  • Mythology
  • Philosophy
  • Security
  • Software Development
  • Technology
  • UI
  • Uncategorized
  • Web Development
  • Writing
  • Writings

Music

Copyright © 2025 · Genesis Child 2 on Genesis Framework · WordPress · Log in