Choosing the main category for a post in Wordpress
i have a post in WP, lets call it Cheesecake. And i have this post set to 3 categories: in "Coffee" in "Cake" and in "Desserts". And now i want the main category for Cheesecake to be "Cake" so the URL would be www.mywordpress.com/category/cake/cheesecake
The problem is: i created the category "Coffee" first and so WP takes the lowest category ID and the URL is www.mywordpress.com/category/coffee/cheesecake
Is there anything i can do to prevent WP from doing this? Ma开发者_运维问答ybe a plugin?
This mechanism is provided by the plugin Yoast SEO. It allows you to select or change the "main" category that is used to create the permalink.
Or you can use WP Category Permalink plugin. It does the same thing.
Is cheesecake a POST or a CATEGORY? It sounds like a category to me. If you are trying to make Cheescake a subcategory of Cake, it's very easy to do:
Go to Categories in the WP admin panel, hover your mouse cursor over the category named Cheesecake and click Edit. In the Edit Category page that opens up, select Cake as the parent category.
Then the URL for posts in the Cheesecake category will be:
www.mywordpress.com/category/cake/cheesecake/your_post
Does that answer your question?
Ok, I see...hmmm that is not something I've ever tried to do.
Do you feel comfortable working with the database? If so, here is a tutorial on how to manually change the category IDs:
http://www.roman-kaeppeler.de/wordpress/change-category-id/?lang=en
I have been looking around online, trying to find a better way to do this and haven't found one yet. But I'll let you know if I do!
精彩评论