Make sure rewrites are added to .htaccess immediately after activation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
### HEAD
|
||||
* Make sure rewrites are added to .htaccess immediately after activation
|
||||
* Move HTML5 Boilerplate's .htaccess to a [plugin](https://github.com/retlehs/wp-h5bp-htaccess)
|
||||
* Rename page-custom.php to template-custom.php
|
||||
* Don't warn about unwritable htaccess if that option is disabled
|
||||
|
||||
@@ -38,8 +38,7 @@ function roots_theme_activation_options_add_page() {
|
||||
);
|
||||
} else {
|
||||
if (is_admin() && isset($_GET['page']) && $_GET['page'] === 'theme_activation_options') {
|
||||
global $wp_rewrite;
|
||||
$wp_rewrite->flush_rules();
|
||||
flush_rewrite_rules();
|
||||
wp_redirect(admin_url('themes.php'));
|
||||
exit;
|
||||
}
|
||||
@@ -217,14 +216,12 @@ function roots_theme_activation_action() {
|
||||
|
||||
if ($roots_theme_activation_options['change_permalink_structure']) {
|
||||
$roots_theme_activation_options['change_permalink_structure'] = false;
|
||||
global $wp_rewrite;
|
||||
|
||||
if (get_option('permalink_structure') !== '/%postname%/') {
|
||||
global $wp_rewrite;
|
||||
$wp_rewrite->set_permalink_structure('/%postname%/');
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
|
||||
$wp_rewrite->init();
|
||||
$wp_rewrite->flush_rules();
|
||||
}
|
||||
|
||||
if ($roots_theme_activation_options['change_uploads_folder']) {
|
||||
|
||||
@@ -35,7 +35,7 @@ function roots_clean_urls($content) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_multisite() && !is_child_theme() && get_option('permalink_structure')) {
|
||||
if (!is_multisite() && !is_child_theme()) {
|
||||
if (current_theme_supports('rewrites')) {
|
||||
add_action('generate_rewrite_rules', 'roots_add_rewrites');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user