save_mod_rewrite_rules
函数
save_mod_rewrite_rules ( No parameters )
- 返回值
-
- (bool|null) True on write success, false on failure. Null in multisite.
- 定义位置
-
-
wp-admin/includes/misc.php
, line 261
-
wp-admin/includes/misc.php
- 引入
- 1.5.0
- 弃用
- –
如果htaccess文件是可写的,则用当前规则更新该文件。
如果该文件存在并可写入,则始终写入该文件,以确保我们清空旧规则。
function save_mod_rewrite_rules() { global $wp_rewrite; if ( is_multisite() ) { return; } // Ensure get_home_path() is declared. require_once ABSPATH . 'wp-admin/includes/file.php'; $home_path = get_home_path(); $htaccess_file = $home_path . '.htaccess'; /* * If the file doesn't already exist check for write access to the directory * and whether we have some rules. Else check for write access to the file. */ if ( ! file_exists( $htaccess_file ) && is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks() || is_writable( $htaccess_file ) ) { if ( got_mod_rewrite() ) { $rules = explode( "n", $wp_rewrite->mod_rewrite_rules() ); return insert_with_markers( $htaccess_file, 'WordPress', $rules ); } } return false; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。