Timeline for Custom permalink structure for posts in certain categories
Current License: CC BY-SA 4.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 10, 2018 at 13:17 | answer | added | vexx | timeline score: 0 | |
Sep 5, 2018 at 10:54 | answer | added | honk31 | timeline score: 0 | |
Sep 4, 2018 at 17:58 | comment | added | vexx | I did, no effect. What do you mean by making a loop through all categories? care to give me an example? | |
Sep 4, 2018 at 14:19 | comment | added | honk31 |
did you try my rewrite? and regarding your guessing/subcategory: inside custom_permalink you only check, if the very first category is ico.. why not make a loop through all categories?
|
|
Sep 4, 2018 at 12:41 | comment | added | vexx | I'm starting to believe that having 2 or more categories assigned to each post may break this code. The main category, ICO, has 3 subcategories and every post from ICO has at least 1 other subcategory. Not sure if this is the problem, but.. | |
Sep 4, 2018 at 12:37 | history | edited | vexx | CC BY-SA 4.0 |
added new code
|
Sep 3, 2018 at 16:44 | comment | added | vexx | I want the permalink structure to be modified to ALL posts, even the already written ones. I can't change the permalink structure of those, even if I edit the permalink under the title, can't add /ico/ it just appends /ico-name/ | |
Sep 3, 2018 at 16:43 | comment | added | honk31 |
ok kool, that is what you want, right?! looks like the first bit of your code is running, that was my question.. so for the rewirte, please try this add_rewrite_rule('ico/(.+?)/?$', 'index.php?name=$matches[1]', 'top');
|
|
Sep 3, 2018 at 16:38 | comment | added | vexx | One more thing, it seems that if I try to create another post from the ICO category, in admin, it automatically ads /ico/ to the permalink. | |
Sep 3, 2018 at 16:37 | comment | added | vexx | The issue is with rewrite, when I paste this function, every widget or post list present on the site doesn't have the URL changed to the /ico/ one. There are however, in those lists, some articles that have /ico/ inside, it's completely random, I'm not sure why. I've checked all these articles, they don't have anything different. It's worth noting that each article has it's main category "ICO" then at least 1 subcategory which has ICO parent. | |
Sep 3, 2018 at 16:32 | comment | added | honk31 | so, you paste your code and edit your post yadayada all works fine, when you hit save, the permalink below the title is all good, has ico inside, the issue comes with the rewrite. correct? | |
Sep 3, 2018 at 16:27 | comment | added | vexx | I resaved a bunch of articles, did a permalink save, added flush_rewrite_rules(); to the function in function.php...nothing works. I'm clearly missing something or there's something wrong with the code. | |
Sep 3, 2018 at 15:58 | comment | added | vexx | as resaving, didn't think of doing that..I'll do that now, I thought this rule works as changing the permalinks from WP directly, you don't need to resave all posts. | |
Sep 3, 2018 at 15:53 | comment | added | vexx | actually I did, nothing happed. Moreover, the posts that have the url changed with the /ico/ category, when I click on them, instead of taking me to the post page, displays the featured image attached to that post. | |
Sep 3, 2018 at 14:18 | comment | added | honk31 | did you flush your rewrite rules afterwards? resaved a post that is inside that specific category..? | |
Sep 3, 2018 at 13:25 | history | asked | vexx | CC BY-SA 4.0 |