I'm using WordPress as a customised CMS for my fishkeeping website.

Currently I'm developing a Custom Post Type called species which produces an information sheet about a specific species of fish.

With no intention of patronising anybody, just in case people aren't familiar with the classification of fishes, in the example below, I'll be referring to "Apistogramma panduro". "Apistogramma" is the "Genus" and "panduro" is the "Species". Both of these are fields in this Custom Post Type.

For example, my Custom Post Type may produce a factsheet about Apistogramma panduro, containing details of how to keep it and breed it, etc.

I'm wondering about the Title of the post because right now all of my posts are being given the Title "Auto Draft X" (X being a number) and as such the URL of "?species=auto-draft-9".

I may be asking a three-pronged question here (the Title of the post, the URL of the post and any potential htaccess rewrites), but basically what I want to do is this: I'd like all of my species profiles to have the Genus and Species in the URL

I'm not too bothered how it's laid out, but this would be ideal: /species/apistogramma/panduro

Apologies if the post isn't best formed, it's 0100 and I've just spent hours with my "head in the code"..! Please don't hesitate to ask for clarity and I'll do my best when I wake up tomorrow.

2 Answers 2


I'm unable to comment on this SX but I would have thought the best way to do what you wanted would have been to use a custom post type, but combine it with a custom taxonomy. In the same way that a post belongs to a category, a fish species could belong to a genus (the genus being the part defined by the custom taxonomy). The genus could then be arranged just like categories if desired - e.g. example.com/fish/apistogramma/panduro.

I'm not experienced in this area of WP development (In fact, I'm just embarking on my first project involving them at the moment) but I think they would have been a better option than modifying the slug to /genus-species.

See http://codex.wordpress.org/Taxonomies for more info.

  • 1
    I can comment now! Hooray.
    – rikkit
    Dec 27, 2011 at 11:00
  • While the original questioner seems to of found a solution he is happy with... Using WordPress Taxonomies for the Fish taxonomies would seem to make way more sense and be a much cleaner solution. One could still generate a custom post title from the assigned taxonomies.
    – jb510
    Dec 29, 2011 at 7:13
  • Hello both. Thanks for your answer @rikkit ; I've awarded you 50 points bounty. You and jb510 are both correct, unfortunately there are some species of fish which are required to be displayed with both italic and non-italic text (i.e. Genus sp. species). This is the scientifically correct way of displaying such classification, and I can't think of a way of allowing this amalgamation of font-styles using WordPress' built-in taxonomic features.
    – turbonerd
    Dec 29, 2011 at 22:05
  • @dunc Out of interest, how are you presenting that in your post slug method? The only way I can think of doing it using taxonomies would be to have a special character in the slug which denoted italics - e.g. your example would become /-genus/sp/-species - and using it when writing it out in text. Not as neat though, obviously.
    – rikkit
    Jan 1, 2012 at 2:12

OK, I've made a few subtle changes which have helped me to solve the problem.

Firstly, a function to change the Title of the post.

function custom_post_type_title ( $post_id ) {
    global $wpdb;
    if ( get_post_type( $post_id ) == 'species' ) {
        $genus = strip_tags(get_post_meta($post_id, 'genus', true));
        $species = strip_tags(get_post_meta($post_id, 'species', true));
        $common_names = strip_tags(get_post_meta($post_id, 'common_names', true));
        if ($common_names) {
            $title = $genus . ' ' . $species . ' (' . $common_names . ')';
        } else {
            $title = $genus . ' ' . $species;

        $where = array( 'ID' => $post_id );
        $wpdb->update( $wpdb->posts, array( 'post_title' => $title ), $where );

add_action( 'save_post', array( &$SpeciesProfile, 'custom_post_type_title' ) );

Secondly, I can manually amend the slug to reflect genus-species.

Thirdly, I set the "permalink" structure to "%postname%".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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