[Plugin: Custom Permalinks] editing parent category breaks custom permalinks for child categories
-
If you have a category A with children X,Y,Z, all of which have custom permalinks defined, then edit A, the custom permalinks break for X,Y,and Z and result in 404 errors. When you go to edit X,Y, or Z, the custom permalink shows up, and re-saving the category (without modifications), fixes the 404 error. I have modified the custom_permalinks_save_term function to prevent this. I don’t think it is a great fix, but it works for now. Here is my new custom_permalinks_save_term function:
function custom_permalinks_save_term($term, $permalink) { custom_permalinks_delete_term($term->term_id); $orig_table = get_option('custom_permalink_table'); $new_table = array(); if ( $permalink ) $new_table[$permalink] = array( 'id' => $term->term_id, 'kind' => ($term->taxonomy == 'category' ? 'category' : 'tag'), 'slug' => $term->slug); foreach ($orig_table as $permalink => $info) { if ( $permalink ) $new_table[$permalink] = array( 'id' => $info['id'], 'kind' => $info['kind'], 'slug' => $info['slug']); update_option('custom_permalink_table', $new_table); } }
- The topic ‘[Plugin: Custom Permalinks] editing parent category breaks custom permalinks for child categories’ is closed to new replies.