Avoid ‘uploads’ 777 permissions: Potential threat or clean solution?

In short: YES, is a big time threat. Explained: Little time has passed since I asked this question but now I have found that the safer and most useful file permissions for wordpress are the following: Directories: 755 Owner can: Read, write and execute. Group and public can: Read and execute. Read-only files:644 Owner can: … Read more

How to Call Function From Separate WordPress Install on Same Server?

Your include path is incorrect. You have: require_once( dirname(__FILE__) . ‘../../../../global_functions.php’); When it should be: require_once( dirname(__FILE__) . ‘../../../../functions/global_functions.php’); The other alternative would be to change your setup from individual standalone installations of WordPress to WordPress Multi-site. You would then have a couple of options: Option #1 being a Must-Use Plugin. Option #2 being a … Read more

How to include all files within a folder & its sub folders to functions.php?

You need to use some recursion on the function: function require_all_files($dir) { foreach( glob( “$dir/*” ) as $path ){ if ( preg_match( ‘/\.php$/’, $path ) ) { require_once $path; // it’s a PHP file so just require it } elseif ( is_dir( $path ) ) { require_all_files( $path ); // it’s a subdir, so call … Read more

Get names and paths from unzip_file()

If i where you i would read the folder where the zip a $path=”/path/to/extract”; $file=”/path/to/zip.zip”; unzip_file( $file, $path ); $files = scandir($path); $files = array_diff(scandir($path), array(‘.’, ‘..’)); // removes empty spots from the array and then do what you want with the files. File names are in the $files array. foreach ($files as $key => … Read more