[Closed] Custom Taxonomies not showing on Permalink

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

This topic contains 9 replies, has 4 voices, and was last updated by  Chris 5 years, 2 months ago. The support staff assigned to this topic is Amir.

Viewing 10 posts - 1 through 10 (of 10 total)
Author
Posts
#3077

Hi, i don't know if i'm doing something wrong but i've problems with the rewriting of my permalinks.

1.I've created with WP-types a new Post Type Name named "Products";
2.I've created a new hierarchical Taxonomy named "Typologies";
3."Typologies" is the registered taxonomy for Products;
4.I've inserted the terms for the "Typologies" taxonomy (Wines, Specialties, Oil and so on, wit subcategories etc.)
5.I've set up the Rewrite option for "Products" and "Typologies";
6.WP permalink set up is customized as "/%category%/%postname%/"

Everything is fine except that the "Typologies" taxonomy is never rewritten in the Permalink, i've tried with many different settings, but nothing.

I expected something like http://www.domain.com/products/wines/reds/nameofthewine/ but i can only get http://www.domain.com/products/nameofthewine/;

So my permalinks are not rewritten with my custom taxonomy, but i'm able to filter by query the results as i can get all of my red wines with "www.domain.com/products/wines/reds/";

Have i missed something?
Thanks in advance, marco

#3145

please someone can help?

#3190

Amir
Forum moderator

That's generally how WordPress produces the rewrite rules. From our previous experience with that, I'd recommend not to try and bent it. WordPress changes the logic going from version 3.0 to 3.1 to 3.2 and now in 3.3. If you leave it as-is, it's going to work. If you set your own private rewrite logic, you can probably get it to work now, but there's a good chance it will not work on future updates.

To experiment with taxonomy rewrite rules, go to the taxonomy setting and scroll to the bottom. It's the last settings.

#9445

@roberta - Did you ever find a solution to this? If so, please share. I'm experiencing the same issue as you described.

#9446

Amir
Forum moderator

Folks, this in not a Types issue. You're welcome to discuss how to get this done with WordPress, but I'm marking this as resolved, as we can't help much in it. Types passes the URL rewrite logic to WP. WP does what it can with it.

#9448

@Amir - Do you, or any of your colleagues, have a suggestion as to how this can be done with WordPress? You obviously have a better understanding of this than we do. Or at least point me to where I should be looking in the Codex? I'm searching the Codex and Googling but haven't found a solution yet.

Thanks

#9449

Amir
Forum moderator

No, sorry. We try to keep away from this sort of thing, based on our previous experience. We handled this in several past events and always failed. Sometimes, things appeared to be working, but then caused other problems with more data, other languages, etc.

So, we're just not using any custom rewrite rules for any of our sites.

#9450

OK, well then my original question to Roberta remains...

@roberta – Did you ever find a solution to this? If so, please share.

#16947

I am VERY patient and friendly on forums because I respect the hard work that goes into all this programing and thats why I pay for these plugins. Don't take this as an insult.

@Amir - You keep pushing everyone away acting like it has nothing to do with WPTypes. Like you said "This in not a Types issue. You're welcome to discuss how to get this done with WordPress, but I'm marking this as resolved".

Its not resolved.

The reason everyone is asking for this (all over your forum) is because your sales pages makes people think that taxonomies work EXACTLY like categories (me being one of them).

Here are some quotes from one of your pages:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PAGE: WordPress Custom Taxonomies
LINK: https://wp-types.com/documentation/user-guides/create-custom-taxonomies/

1) Custom taxonomy lets you organize your custom post types. It’s like categories and tags for posts, but used for any custom type that you define.
- Its like categories BUT used for CUSTOM posts

2) Hierarchical taxonomy works just like post categories.
- No it does not. You just select them the same way. And yes things get categorized, but not JUST LIKE categories.

3) Unlike post categories and tags, which are built-in to WordPress, you setup custom taxonomy, specifically for your custom post types.

- Like this last one, UNLIKE categories, you can do this this as well etc....
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Again, I'm not mad. Im a happy paying customer that loves WP-Types. A lot of people buying this thinks it will work JUST LIKE CATEGORIES. That being said you can just say "Im marking this as resolved, search somewhere else"

Hope you all at WP-Types understand.

🙂 <---- Happy lol

#16949

@roberta I got this to work with no problems at all

To everyone that needs this end result: http://www.example.com/Post-Type/Taxonomy/Post-Title

Im going to be very detailed to make sure its really easy with no mistakes.

- - - - - - - - - - - - - - - - - - -
STEP ONE
- - - - - - - - - - - - - - - - - - -

Create/Edit your WP-Types Taxonomy with these settings

My Taxonomy is for locations in USA so I named it "States" (use whatever you want of course)

--- Name and Desc. ---

Plural: States
Singular: State
Slug: state

--- Visibility ---

Make this taxonomy public (will appear in the WordPress Admin menu)

--- Select Post Types ---

Choose the Custom Post Type that you will using with this new taxonomy. If you haven't created a Custom Post Type yet you can come back to this step.

--- Labels ---

Don't change anything here!

--- Advanced ---

- SELECT: "Hierarchical - like post categories, with parent / children relationship and checkboxes to select taxonomy"

- SELECT: Rewrite (very important)

- Leave "Prepend posts with this slug" BLANK!!!!

- SELECT: Allow permalinks to be prepended with front base

- SELECT: Hierarchical URLs

- SELECT: show_ui

- SELECT: show_in_nav_menus (incase you want to add this taxonomy/category to your menus

- SELECT: show_tagcloud

- SELECT: query_var

- Leave the last two boxes BLANK! Not needed.

Scroll to the bottom and SAVE

- - - - - - - - - - - - - - - - - - -
STEP TWO
- - - - - - - - - - - - - - - - - - -

Create/Edit your WP-Types Post-Type with these settings

My Post-Type is for locations so I named it "Location"

--- Name and Desc. ---

Plural: Locations
Singular: Location
Slug: location

--- Visibility ---

SELECT: Make this Type public (will appear in the WordPress Admin menu)

--- Select Taxonomies ---

Choose the Taxonomies that you will using with this new taxonomy. If you haven't created a Custom Post Type yet you can come back to this step.

--- Labels ---

DONT NEED TO TOUCH THESE

--- Display Sections ---

DONT NEED TO TOUCH THESE

--- Advanced ---

- SELECT: Rewrite

- SELECT: Use a custom URL format

Write this: PostType/%taxonomy% (but use your post and tax)
MY EXAMPLE: location/%state%

- SELECT: Allow permalinks to be prepended with front base

DONT WORRY ABOUT THE REST

Scroll to the bottom and SAVE

- - - - - - - - - - - - - - - - - - -
STEP THREE (last step)
- - - - - - - - - - - - - - - - - - -

Below is a tiny code that you paste in to your Functions.php. If this whole 3 step process doesn't work, you may have done this step (step three) incorrectly.

FILE LOCATION: …../wp-admin/themes/your-theme/functions.php

In the code below, replace the word state (there are 6 you need to replace) with your Taxonomy Slug from step one and you're done!!

// custom taxonomy permalinks
add_filter('post_link', 'state_permalink', 10, 3);
add_filter('post_type_link', 'state_permalink', 10, 3);

function state_permalink($permalink, $post_id, $leavename) {
        if (strpos($permalink, '%state%') === FALSE) return $permalink;

        // Get post
        $post = get_post($post_id);
        if (!$post) return $permalink;

        // Get taxonomy terms
        $terms = wp_get_object_terms($post->ID, 'state');
        if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;
        else $taxonomy_slug = 'other';

        return str_replace('%state%', $taxonomy_slug, $permalink);
}
Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘[Closed] Custom Taxonomies not showing on Permalink’ is closed to new replies.