Complete the code to set the correct file permission for a WordPress configuration file.
chmod('wp-config.php', intval([1], 8));
The wp-config.php file should have permission 0644 to allow the owner to read and write, and others to read only. This helps protect sensitive configuration data.
Complete the code to set the correct directory permission for WordPress content folders.
chmod('wp-content/uploads', intval([1], 8));
Directories like wp-content/uploads should have permission 0755 to allow the owner full access and others read and execute access, which is needed to access files inside.
Fix the error in the code that sets file permissions for all PHP files in the theme folder.
foreach (glob('wp-content/themes/mytheme/*.php') as $file) { chmod($file, intval([1], 8)); }
PHP files should have permission 0644 to allow the owner to read/write and others to read only, preventing unauthorized modifications.
Fill both blanks to set secure permissions for WordPress core files and directories.
chmod('wp-admin', intval([1], 8)); chmod('index.php', intval([2], 8));
Directories like wp-admin should have 0755 permission for proper access, while core files like index.php should have 0644 to prevent unauthorized changes.
Fill all three blanks to create a secure permissions setup for WordPress uploads folder and its files.
chmod('wp-content/uploads', intval([1], 8)); foreach (glob('wp-content/uploads/*') as $item) { if (is_dir($item)) { chmod($item, intval([2], 8)); } else { chmod($item, intval([3], 8)); } }
The uploads folder and its subdirectories should have 0755 permission to allow access, while files inside should have 0644 to prevent unauthorized writing.