Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How would I build something like this with wordpress. Where multiple tags texts all go to the same page.
enter image description here

If you click on the tag "scifi" it takes you to tag "science fiction". I am not looking for a way to merge them.

I want the tag text to vary, but the end page to be the same. Any Ideas?

A physical redirect shouldn't be needed. The tag text of X needs to be linked to Y when wordpress builds the link.

Example: If I type "scifi" as a tag, and the link gets build as <a href="/tag/science fiction">scifi</a> and therefore the tag is an alias for "science fiction".

Where would I hook in to do this?

share|improve this question

3 Answers 3

I can use the term_link filter, for the linking half of this problem:

Here is a basic,still hard coded, version:

<?php
/*
Plugin Name: Tag Alias
Version: 0.001
Plugin URI: 
Description: Adams Tag Alias -> hard coded tag redirects
Author: Adam
*/

$aliases = array (
    "450"  => "400",
    "speed controler" => "esc",
    "kds" => "esc"
);

function tagAliasFilter ($termlink, $term, $taxonomy) {
    global $aliases;
    foreach ($aliases as $alias => $key)
    if($term->slug == $alias)
    {
        $termlink = str_replace($alias,$key,$termlink);     
    }   
    return $termlink;
}
add_filter('term_link', 'tagAliasFilter',10,3);
?>

Now what is missing is pulling in the aliases on the tag pages

share|improve this answer

Have not tested tested yet, but I see in the Codex page for wp_insert_term there's one argument alias_of, which is described:

There is no default, but if added, expected is the slug that the term will be an alias of. Expected to be a string.

Maybe it helps ;)

share|improve this answer
    
I talked about this one to some core people some month ago. Point is: It's there, but not implemented :) –  kaiser Dec 9 '11 at 17:18
    
Oh! so close to a baked in solution :( –  Adam Dec 9 '11 at 20:05

I guess the best would be to simply merge synonyms. You can use this plugin - @scribu is a trusted author.

share|improve this answer
    
However, I said in my question "I am not looking for a way to merge them" –  Adam Dec 8 '11 at 21:31
    
Yea, I know. I thought about redirecting, but if you're going to have a lot of synonyms, then everything will slow down (and I'm talking about really slow). Just check the "description" meta tag in your links head. What they're doing is not really good... –  kaiser Dec 8 '11 at 22:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.