• Resolved alx359

    (@alx359)


    Hello,

    I can’t find a proper way to modify the final slug for each category. Now if I have a category ‘cars’, the slug for it comes as ‘catablog-term-cars’, but would like it to be just ‘cars’, for a better SEO.

    I see the wp_terms stores each slug as catablog-term-<category> format. Why would one need a slug prefix if it can be differentiated by wp_term_taxonomy.term_id?

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter alx359

    (@alx359)

    Zach, the only place where “catablog-term-” prefix seems set is here:

    private function string2slug($string) {
    		$slug = "catablog-term-" . strtolower($string);
    		return  wp_unique_term_slug($slug, null);
    	}

    Is it possible I strip this, or at least change to something more suitable my project, with no adverse side-effects? (of course need to update table wp_terms.slug). Please advise.

    Thanks.

    Plugin Author macguru2000

    (@macguru2000)

    You may strip it out or change it, but before you do that read on.

    In case you were unaware each taxonomy term slug must be unique across all taxonomies. This means if you have a WordPress category with the slug cars and a CataBlog category with the slug cars, you will see odd behaviors and unexpected results.

    To fix this problem in a past version of CataBlog, before there ever was a public option, I added the prefix to CataBlog terms. Now I will need to make it configurable in a future version.

    Thread Starter alx359

    (@alx359)

    I see, thanks for the information!

    But isn’t reasonable to think that uniqueness is reached as the whole path consisting of taxonomy+slug? Isn’t that enough?

    Or as in my CataBlog setup:

    Category Pages Slug: [gallery]

    The composite slug would be: [gallery/catablog-term-cars] or [gallery/cars] as I’d prefer.

    If I have another category named [cars] the slug would be mysite.com/[cars] or [topic/cars] if using a taxonomy base, so the uniqueness would be kept.

    Anyway, if you consider putting that prefix as configurable in a future version it will be great!

    Plugin Author macguru2000

    (@macguru2000)

    I am not referring to the url but a core WordPress requirement. If you want two different categories, even if in different taxonomies, WordPress requires they have different slug values. Period. Nothing I know of besides hacking WordPress to get around this limitation. Sorry.

    Also, just to clarify WordPress does not store the entire “slug” in the database, but just the category’s slug value. Look in the database to see what I mean.

    Thread Starter alx359

    (@alx359)

    I see, thanks again. Still a newbie to WP.

    To have this as a configurable value is a very good option though, as the prefix can be part of the site’s niche. I’ve changed it to something more suitable, thanks to your helpful comments.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘modifying catablog-term slug prefix?’ is closed to new replies.