diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 9c5a40c35d..1c70d199bf 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -490,7 +490,7 @@ function extract_from_markers($filename, $marker) { } function save_mod_rewrite_rules() { - global $is_apache; + global $is_apache, $wp_rewrite; $home = get_settings('home'); if ( $home != '' && $home != get_settings('siteurl') ) { $home_path = parse_url($home); @@ -506,15 +506,13 @@ function save_mod_rewrite_rules() { else $writable = false; - $permalink_structure = get_settings('permalink_structure'); - - if ( strstr($permalink_structure, 'index.php') ) // If they're using + if ($wp_rewrite->using_index_permalinks()) $usingpi = true; else $usingpi = false; if ( $writable && !$usingpi && $is_apache ) { - $rules = explode("\n", mod_rewrite_rules($permalink_structure)); + $rules = explode("\n", $wp_rewrite->mod_rewrite_rules()); insert_with_markers($home_path.'.htaccess', 'WordPress', $rules); } } diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index dd762b317d..21447abfe0 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -21,22 +21,20 @@ if ( isset($_POST) ) { $permalink_structure = $_POST['permalink_structure']; if (! empty($permalink_structure) ) $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']); - update_option('permalink_structure', $permalink_structure); + $wp_rewrite->set_permalink_structure($permalink_structure); } if ( isset($_POST['category_base']) ) { $category_base = $_POST['category_base']; if (! empty($category_base) ) $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']); - update_option('category_base', $category_base); + $wp_rewrite->set_category_base($category_base); } } $permalink_structure = get_settings('permalink_structure'); $category_base = get_settings('category_base'); -get_date_permastruct(); - generate_page_rewrite_rules(); if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') ) @@ -44,7 +42,7 @@ if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_wri else $writable = false; -if ( strstr($permalink_structure, 'index.php') ) // If they're using +if ($wp_rewrite->using_index_permalinks()) $usingpi = true; else $usingpi = false; @@ -106,7 +104,7 @@ save_mod_rewrite_rules();
.htaccess was writable we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess
file. Click in the field and press CTRL + a to select all.') ?>