wc_ms_protect_download_rewite_rules()WC 1.0

Protect downloads from ms-files.php in multisite.

Хуков нет.

Возвращает

Строку.

Использование

wc_ms_protect_download_rewite_rules( $rewrite );
$rewrite(строка) (обязательный)
rewrite rules.

Код wc_ms_protect_download_rewite_rules() WC 8.7.0

function wc_ms_protect_download_rewite_rules( $rewrite ) {
	if ( ! is_multisite() || 'redirect' === get_option( 'woocommerce_file_download_method' ) ) {
		return $rewrite;
	}

	$rule  = "\n# WooCommerce Rules - Protect Files from ms-files.php\n\n";
	$rule .= "<IfModule mod_rewrite.c>\n";
	$rule .= "RewriteEngine On\n";
	$rule .= "RewriteCond %{QUERY_STRING} file=woocommerce_uploads/ [NC]\n";
	$rule .= "RewriteRule /ms-files.php$ - [F]\n";
	$rule .= "</IfModule>\n\n";

	return $rule . $rewrite;
}