Timeline for Changing custom post type URL issue
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 22, 2015 at 16:30 | comment | added | Milo |
you would swap post_type=item&p=$matches[1] with item=$matches[1]
|
|
Jan 22, 2015 at 11:54 | vote | accept | Valeka | ||
Jan 22, 2015 at 11:54 | comment | added | Valeka |
Thank you so much! I have just one more question, what if I want to use post name insted of post ID in URL? I put in the first function return home_url('food/'. $post->post_name); , how should I change add_rewrite_rule? And thank you once more for your respond! @Milo
|
|
Jan 21, 2015 at 20:04 | comment | added | Milo | sorry, there was a typo in the rule, edited version above is tested and working. | |
Jan 21, 2015 at 20:01 | history | edited | Milo | CC BY-SA 3.0 |
added 9 characters in body
|
Jan 21, 2015 at 19:49 | comment | added | Valeka | Thanks, I tried but nothing. I'm going to look for different solution. | |
Jan 21, 2015 at 14:40 | comment | added | Milo | After adding or changing rewrites you must flush rules. Visiting the permalinks settings admin page is the simplest way to do this. | |
Jan 21, 2015 at 10:11 | comment | added | Valeka | Thanks but still 404. Maybe I should do flush_rewrite somewhere or something similar. @Milo | |
Jan 20, 2015 at 22:18 | history | answered | Milo | CC BY-SA 3.0 |