How to Change File Permissions in WordPress?
Last Updated :
23 Jul, 2025
WordPress is a CMS or content management system that is very popular and used because of its features to create and manage websites such as blogs, e-commerce platforms, etc without having to code the website, it is important to understand the file permissions and how we can control it for making sure that the website is secure.
These are the following are some popular methods used for changing the file permissions for WordPress:
Using FTP Account
We can easily change the file permissions in WordPress if we have an FTP account set up, an FTP account is one provided by our hosting company so that we can easily manage the files which are located in the server for our website.
Steps to change file permissions in WordPress Using FTP Account
Step 1: Open Control Panel
The first step is opening the control panel, simply go to the service provider of hosting that host your website and log in, after login you will see an option for the control panel (it can differ from one hosting company to another) click on it.
Open Control Panel.Step 2: Open FTP Accounts:
Now you will have to click on the open FTP accounts option, this will give us the details about the FTP accounts such as host and port and host password etc.
Open FTP Accounts.Step 3: Open FTP Software and Log in
- Now the next step is to copy the details from the control panel in the above step and add it in any FTP software such as the FileZilla:
- If you are not familiar with FTP software and how they work, then read the following article:
- How to install FileZilla on Windows?
- After entering the details click on quickconnect and let it connect to your files of the website.
Open FTP Software and Log in.Step 4: Change File Attributes
Once the FileZilla is connected, open any file or folder you want to change the permissions for and right click on it then select the file permissions according to your needs and requirements, next click on the OK button to save this change.
Change file attributes.Using cPanel of Hosting Provider
We can also change the file permissions directly from the cPanel itself without having to connect it to any FTP software.
Steps to change file permissions in WordPress Using cPanel of Hosting Provider
Step 1: Open File Manager
After logging into the cPanel as we did in the previous step, we will go to the online file manager (name can be different in other hosting providers)
Open File Manager.Step 2: Click on CHMOD
Once the file directories opens, simply go to /htdocs/ and here the Wordpress files will be stored, click on the files or folders you want to make changes to and right click on it, then select the CHMOD option which will allows us to change the file permission.
Click on CHMOD.Once the menu opens, enter the file permission code, following are the different types of file permissions:
- 755 (drwxr-xr-x): It is used for the folders and we can use this file permission in order to allow the website owner to read, write and execute.
- 644 (-rw-r--r--): this is a common file permission which allows only the owner to read and write the files, other people can only read it.
- 640 (-rw-r-----): it is a strict file permission, it allows the owner to both read and write but only allows group to read and does not allow any other access to others.
- 600 (-rw-------): this is a file permission which only allows the owner to read and write.
- 444 (-r--r--r--): this file permission is used when we want to make a file read only for everyone.
Using Wordpress Theme Code editor
We can also edit the file permissions using the Wordpress itself, this method is easy and straightforward for those who wants to change the file permissions of their Wordpress files without having to open the hosting and cPanel.
Steps to change file permissions in WordPress Using Wordpress Theme Code editor
Step 1: Open Theme File Editor
First step is to login to the Wordpress admin page and then go to Appearance > Theme File Editor
Open Theme File Editor.Step 2: Add Additional Code
Now we will have to add the following lines of code to the functions.php file:
Add Additional Code Here.This step is most important in this method so that we can change the code from here and it will automatically set the file permission to the Wordpress file:
PHP
function change_uploads_permissions() {
$uploads_dir = wp_upload_dir()['basedir'];
$permissions = 0755;
if (file_exists($uploads_dir)) {
// Set permissions for the uploads directory itself
chmod($uploads_dir, $permissions);
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($uploads_dir, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST
);
foreach ($iterator as $file) {
$filePath = $file->getPathname();
if ($file->isFile()) {
// Set permissions for individual files
chmod($filePath, $permissions);
} elseif ($file->isDir()) {
// Set permissions for directories
chmod($filePath, $permissions);
}
}
}
}
add_action('init', 'change_uploads_permissions');
In the $permissions enter the required file permission code as per your needs, all the file permissions are already mentioned in the above method.
Conclusion
If we manage to set the correct file permissions for the wordpress websites, we can protect the files from hackers and other cyber attacks, it can also prevent the malwares which can enter the websites and delete important files. By following the steps and methods mentioned above we can easily set the required file permissions.
Similar Reads
WordPress Tutorial WordPress is one of the most popular and free open-source content management systems (CMS) that allows users to create and manage websites with ease. Wordpress developed by Matt Mullenweg and it powers 43.4% of all websites on the internet. WordPress is known for its user-friendly interface, flexibi
9 min read
WordPress Introduction WordPress is one of the most popular platforms for building websites, from simple blogs to complex e-commerce sites. WordPress is a user-friendly platform that empowers anyone to build and manage attractive websites. WordPress is a powerful tool that lets you create and manage the content on your we
4 min read
Installation of WordPress on Windows If you want to build a website using WordPress on your Windows machine, youâre in the right place! WordPress is an open-source Content Management System (CMS) that allows you to create dynamic websites and blogs. Setting up WordPress on your Windows computer is a great way to create a local environm
4 min read
How to Install WordPress on Your Website ? WordPress is a content management system that allows you to host and build websites. WordPress contains plugin architecture and a template system, so you can customize any website to fit your business, blog, portfolio, or online store. WordPress is well-known for its ease of installation. Installing
7 min read
Wordpress Settings
WordPress General SettingWordPress General Settings are basic configurations that control the main aspects of your website, such as the site title, tagline, URL, timezone, and language. These settings help define your siteâs identity, manage how it appears to visitors, and ensure proper functionality across different region
4 min read
WordPress Writing SettingThe Writing Settings in WordPress offer a range of configurations that help you control your content creation and publishing experience. These settings are important for managing how you add and edit posts, pages, and other types of content, as well as for optimizing how your content is delivered to
5 min read
WordPress Reading SettingIn WordPress, the Reading Settings play a key role in shaping the user experience on your website. By configuring these settings effectively, you can customize how content is presented to visitors and optimize your siteâs performance. This article will walk you through the Reading Settings in WordPr
4 min read
WordPress Discussion SettingThe WordPress Discussion Settings allow you to control how comments are managed and displayed on your site. In this article, we will explore how to navigate and configure the Discussion Settings in WordPress, helping you to manage your site's comments and interactions effectively.What Are WordPress
5 min read
WordPress Media SettingWordPress provides a dedicated section called Media Settings, allowing users to configure how media files, such as images and videos, are stored, displayed, and managed on their websites. Proper configuration of these settings can improve your website's performance, optimize media for various uses,
3 min read
WordPress Permalink SettingPermalinks, or permanent links, are the URLs used to link to your content in WordPress. They help in making your content structured and accessed by users and search engines. You can navigate to WordPress permalink settings by going to Dashboard -> Settings -> Permalink. It looks something like
2 min read
WordPress Plugin SettingSetting up your WordPress plugins correctly makes your website run smoothly and efficiently. WordPress plugins are one of the most important parts of WordPress it is just like the apps on mobile phones which add extra functionality to your mobile phone like WordPress plugins add new and more feature
6 min read
Wordpress Categories
Wordpress Posts
WordPress Add PostsBlog posts in WordPress are the core of any websiteâs content strategy, allowing you to share articles, updates, and multimedia content like text, images, videos, and links. Whether you share news, personal experiences, or expert advice, understanding how to add and manage posts in WordPress is impo
5 min read
WordPress Edit PostsOne of the best features of WordPress sites is editing posts. Whether you need to update information, fix a typo, or improve your SEO, knowing how to edit posts in WordPress is good to know. This article will guide you through the process step-by-step, ensuring you can efficiently manage your conten
3 min read
WordPress Delete PostsWordPress is one of the most popular content management systems (CMS) in the world, making it easy for anyone to create and manage their own website. As you publish content, you might find that some posts become outdated or no longer relevant. In such cases, deleting posts is a necessary task to kee
3 min read
WordPress Preview PostsWordPress, the worldâs most popular content management system (CMS), powers over 40% of all websites on the internet. One of its standout features is the ability to preview posts before they go live. This ensures that content creators and website administrators can see exactly how a post will appear
4 min read
WordPress Publish PostsPublishing posts on WordPress is a fundamental skill for anyone looking to share content on their blog or website. Whether you are new to WordPress or need a refresher, this guide will walk you through the steps to publish posts easily and effectively. Step-by-Step Guide to Publishing a Post on Word
2 min read
Wordpress Media
WordPress Media LibraryThe WordPress Media Library is an essential component of any WordPress-powered website. It serves as the central hub for managing all media files, including images, videos, audio files, and documents. Whether you're a beginner or an experienced user, understanding how to effectively use the Media Li
6 min read
WordPress - Add MediaIn the digital world, pictures and videos play an important role in grabbing people's attention and communicating messages effectively. WordPress, a popular website platform, has a handy feature called Add Media that allows you to easily insert images, videos, and other media into your content. In T
4 min read
WordPress Insert MediaWordPress is a tool and an open-source Content Management System that is totally based on PHP and MySql which is used to create a dynamic website. WordPress was written in PHP language by Matt Mullenweg. It is one of the most popular interfaces that allow users to customize and manage the website fr
3 min read
WordPress Edit MediaWordPress is an open-source Content Management System that is totally based on PHP and MySql which is used to create a dynamic website. Matt Mullenweg developed WordPress and Written in PHP language. WordPress is one of the most popular interfaces that allow users to customize and manage the website
2 min read
Wordpress Pages
WordPress Add PagesWordPress Known for its flexibility, ease of use, and extensive customization options, WordPress allows users to create and manage a wide range of websites, from simple blogs to complex e-commerce platforms. One of the core features of WordPress is the ability to add and manage pages, which are esse
5 min read
WordPress Publish PagesWordPress pages are static, timeless pieces of content that are not typically included in your site's blog structure (unlike posts). They are ideal for timeless content such as "About Us," "Contact," "Services," and "Privacy Policy" pages.How to Create and Publish a Page in WordPressPublishing a new
2 min read
WordPress Edit PagesWhen it comes to managing your WordPress website, understanding how to edit pages effectively is key to maintaining fresh and engaging content.Why Edit Pages in WordPress?Editing pages in WordPress allows you to update your website's content without needing technical expertise. This flexibility empo
3 min read
How to Preview WordPress Website?Previewing your WordPress website before it goes live is good for ensuring it looks perfect and functions correctly. By previewing, you can catch errors, check design elements, test functionality, and optimize your content for SEO. Follow this article to preview your WordPress website easily and qui
3 min read
How to Delete Pages in WordPressDeleting pages in WordPress is a common task that website designers and administrators perform to keep their websites clean and up-to-date. Whether you need to remove outdated content, reduce clutter, or simply reorganize your pages, knowing how to delete pages in WordPress efficiently is essential.
3 min read
Wordpress Tags