Why Your Local WordPress Site Looks Broken: Fixing Missing CSS and Styling Issues
Content
If you've set up a local WordPress development environment using tools like XAMPP, MAMP, or Local by Flywheel, only to find your themes display as plain text without any styling, you're not alone. This is one of the most common issues faced when starting with local development. This guide will walk you through why this happens and the most effective solutions to get your site looking right.
Why Does This Happen?
The core of the problem almost always lies in how the browser is trying to load your site's assets, like CSS files, JavaScript, and images. On a live server, the website address (URL) is a fixed domain name. On your local machine, this address is often localhost or a specific IP address. If WordPress is configured to look for files in one place, but the browser is trying to load them from another, those requests fail, resulting in a broken, unstyled site.
How to Fix Missing CSS on Your Local WordPress Site
1. Check and Correct Your WordPress and Site Address URLs
This is the most common fix. If your WordPress Address and Site Address are set to something like http://localhost:8888 but you are accessing the site through a different URL (like your machine's IP address), the asset links will break.
- Log into your WordPress admin dashboard (e.g.,
http://localhost:8888/wp-admin). - Navigate to Settings > General.
- Ensure both the WordPress Address (URL) and Site Address (URL) fields match the exact URL you are using to view your site in the browser's address bar.
- Save changes. You may need to log in again.
2. Investigate Using Your Browser's Developer Tools
Your browser's built-in developer tools are your best friend for diagnosing this issue. They will show you exactly which files are failing to load.
- Open your broken local site in Chrome or Firefox.
- Right-click on the page and select Inspect.
- Open the Console tab. Any errors loading CSS or JavaScript files will be listed here in red.
- Open the Network tab and reload the page. Look for any files (especially .css files) that have a status code like 404 (Not Found) or 403 (Forbidden). This tells you the server couldn't find the file or didn't have permission to serve it.
3. Verify File Permissions
Incorrect file permissions can prevent the local server (Apache/Nginx) from reading and serving your theme's CSS files. This is a common issue on Linux-based local setups (including Ubuntu in a virtual machine).
- Navigate to your WordPress installation directory (e.g.,
/var/www/html/orhtdocs). - Run the following commands to reset permissions (you may need to use
sudo):find /path/to/your/wordpress/ -type f -exec chmod 644 {} ;find /path/to/your/wordpress/ -type d -exec chmod 755 {} ;
4. Understand That Some "Missing" Images Are Normal
As seen in the sample threads, there is often confusion about demo content. Many themes showcase beautiful demo sites with placeholder images and sample pages. The theme itself often does not include these images; they are part of a separate demo content import process.
If you activate a new theme and see a basic, unstyled page with your site's title and a sample post, that is often the expected behavior until you add your own content or import the theme's demo data.
5. For Advanced Network Access
If you are trying to access your local site from another device on your network (e.g., viewing your VM's site from your host machine), you must change the WordPress Address and Site Address from localhost to the local IP address of the machine hosting the site (e.g., http://192.168.1.50). The 'Localhost Installs' team suggests this is a critical step for cross-network previewing.
When to Look Elsewhere
If the solutions above don't resolve your issue, the problem might be specific to your theme or a plugin. A recommended step is to temporarily switch to a default WordPress theme like Twenty Twenty-Two to see if the problem persists. If the default theme works, the issue is likely with your custom theme's configuration or a plugin conflict.
For theme-specific issues, such as missing social icons or customizer problems, it's best to seek help in that theme's dedicated support forum where its developers can provide specific guidance.
By methodically working through these steps—starting with your site's URL settings—you can almost always resolve the frustrating issue of a broken-looking local WordPress installation and get back to building your site.
Related Support Threads Support
-
Only displays text from site – new installhttps://wordpress.org/support/topic/only-displays-text-from-site-new-install/
-
Download Themes on Localhosthttps://wordpress.org/support/topic/download-themes-on-localhost/
-
WordPress in virtual box don’t display righthttps://wordpress.org/support/topic/wordpress-in-virtual-box-dont-display-right/
-
Latest Site Version not loading on local hosthttps://wordpress.org/support/topic/latest-site-version-not-loading-on-local-host/
-
Anyone help me to fix wordpress theme on Synology NAShttps://wordpress.org/support/topic/anyone-help-me-to-fix-wordpress-theme-on-synology-nas/
-
Newbie. What have I done wrong here?https://wordpress.org/support/topic/newbie-what-have-i-done-wrong-here/
-
Title label in Widget doesn’t show uphttps://wordpress.org/support/topic/title-label-in-widget-doesnt-show-up/
-
WP no pictures in themehttps://wordpress.org/support/topic/wp-no-pictures-in-theme/
-
new post do not get displayed in the outputhttps://wordpress.org/support/topic/new-post-do-not-get-displayed-in-the-output/
-
Preview Modeshttps://wordpress.org/support/topic/preview-modes/
-
Every single template missing CSShttps://wordpress.org/support/topic/every-single-template-missing-css/
-
Ashe theme issue in localhosthttps://wordpress.org/support/topic/ashe-theme-issue-in-localhost/
-
WordPress layout not shown correctlyhttps://wordpress.org/support/topic/wordpress-layout-not-shown-correctly/
-
Can’t Search for Themes Locallyhttps://wordpress.org/support/topic/cant-search-for-themes-locally/
-
incorrectly themes installinghttps://wordpress.org/support/topic/incorrectly-themes-installing/
-
WordPress only correctly displayed when connecting locallyhttps://wordpress.org/support/topic/wordpress-only-correctly-displayed-when-connecting-locally/
-
Defualt themes have no CSS after insatll on MAMPhttps://wordpress.org/support/topic/defualt-themes-have-no-css-after-insatll-on-mamp/
-
Changing Bakery Pluginhttps://wordpress.org/support/topic/changing-bakery-plugin/
-
Install in localhost without downloading imageshttps://wordpress.org/support/topic/install-in-localhost-without-downloading-images/
-
New theme installs with no imageshttps://wordpress.org/support/topic/new-theme-installs-with-no-images/
-
how to install many themes on the localhost?https://wordpress.org/support/topic/how-to-install-many-themes-on-the-localhost/
-
How to Text Align a Theme?https://wordpress.org/support/topic/how-to-text-align-a-theme/
-
Missing Widget Areas On Localhost Sitehttps://wordpress.org/support/topic/missing-widget-areas-on-localhost-site/
-
Too many fonts in menuhttps://wordpress.org/support/topic/too-many-fonts-in-menu/
-
Local host and real host theme updates issuehttps://wordpress.org/support/topic/local-host-and-real-host-theme-updates-issue/
-
Broken images on header when migrated to local hosthttps://wordpress.org/support/topic/broken-images-on-header-when-migrated-to-local-host/
-
localhost and menu image ?https://wordpress.org/support/topic/localhost-and-menu-image/
-
Child theme with localhosthttps://wordpress.org/support/topic/child-theme-with-localhost/
-
Theme dont loadhttps://wordpress.org/support/topic/theme-dont-load-2/
-
Theme Installation on localhost does not workhttps://wordpress.org/support/topic/theme-installation-on-localhost-does-not-work/
-
Broken Image the Themehttps://wordpress.org/support/topic/broken-image-the-theme/
-
Unable to view icons next to “Hide Controls” in admin customize.phphttps://wordpress.org/support/topic/unable-to-view-icons-next-to-hide-controls-in-admin-customize-php/
-
Local save in customizer doesn’t stickhttps://wordpress.org/support/topic/local-save-in-customizer-doesnt-stick/
-
CSS Styling A Mess After Changeshttps://wordpress.org/support/topic/css-styling-a-mess-after-changes/