• I want to create a custom permalink based on a custom-post type and and 3 types of custom taxonomy
    in this way:
    mysite.com/custom-taxonomy-1/custom-taxonomy-2/custom-taxonomy-3/postname.html

    How it works?

Viewing 16 replies (of 16 total)
  • works for me. You can use this plugin to make your life easier:
    https://www.ads-software.com/extend/plugins/gd-taxonomies-tools/

    and put this functions in you function.php to make permalink works:

    add_filter('post_type_link', 'filter1', 1, 3);
    function filter1( $post_link, $id = 0, $leavename = false ) {
        if ( strpos('%citys%', $post_link) > 0 ) return $post_link;
        $post = get_post($id);
        if ( !is_object($post) || $post->post_type != 'test' ) return $post_link;
        $terms = wp_get_object_terms($post->ID, 'cidades');
        if ( !$terms ) return str_replace('test/%citys%/', '', $post_link);
        return str_replace('%citys%', $terms[0]->slug, $post_link);
    }

    [Please post code snippets between backticks or use the code button.]

Viewing 16 replies (of 16 total)
  • The topic ‘Create custom Permalink with custom post type and custom taxonomy’ is closed to new replies.