Snippets

Visser Labs Override the temporary files directory for your hosting server

Updated by Michael Visser

File functions.php Modified

  • Ignore whitespace
  • Hide word diff
 function custom_woo_ce_sys_get_temp_dir() {
 
 	// This is the full path to the new temp directory
-	// $path = ABSPATH . 'tmp' // This is a sample path using the WordPress ABSPATH Constant
-	$path = 'PATH_TO_TMP_DIRECTORY';
+	$path = ABSPATH . 'tmp'; // This is a sample path using the WordPress ABSPATH Constant
+	// $path = 'PATH_TO_TMP_DIRECTORY';
 
 	// ini_set() adds a new PHP configuration value informing PHPExcel of the new temp directory
 	ini_set( 'upload_tmp_dir', $path );
Updated by Michael Visser

File functions.php Modified

  • Ignore whitespace
  • Hide word diff
 <?php
 function custom_woo_ce_sys_get_temp_dir() {
 
+	// This is the full path to the new temp directory
+	// $path = ABSPATH . 'tmp' // This is a sample path using the WordPress ABSPATH Constant
 	$path = 'PATH_TO_TMP_DIRECTORY';
+
+	// ini_set() adds a new PHP configuration value informing PHPExcel of the new temp directory
+	ini_set( 'upload_tmp_dir', $path );
 	return $path;
 
 }
Updated by Michael Visser

File functions.php Modified

  • Ignore whitespace
  • Hide word diff
 <?php
 function custom_woo_ce_sys_get_temp_dir() {
-$path = 'PATH_TO_TMP_DIRECTORY';
-return $path;
+
+	$path = 'PATH_TO_TMP_DIRECTORY';
+	return $path;
+
 }
 add_filter( 'woo_ce_sys_get_temp_dir', 'custom_woo_ce_sys_get_temp_dir' );
 ?>
Created by Michael Visser

File functions.php Added

  • Ignore whitespace
  • Hide word diff
+<?php
+function custom_woo_ce_sys_get_temp_dir() {
+$path = 'PATH_TO_TMP_DIRECTORY';
+return $path;
+}
+add_filter( 'woo_ce_sys_get_temp_dir', 'custom_woo_ce_sys_get_temp_dir' );
+?>
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.