How to Solve load error: failed to find main.less in WordPress

Jun 29, 2016
avesdesign

Less is a great stylesheet language. It basically is a dynamic stylesheet language that’s complied into CSS. It can run both on the client side or on the server side depending on how you choose to use it. It was largely influenced by Sass but it’s easier to set up and use than Sass, so it’s great for beginners before they decide to dive in the world of Sass and Compass. The main difference between Less and other stylesheet languages is that it offers a real-time compilation by the browser via less.js.

But using Less (like any other programming language really) can result in some issues and you need to know how to fix them in order to have a fully working website. If you’re an experienced web developer you shouldn’t really have any problem fixing various errors, but if you’re a beginner web developer, or if you’re not a web developer at all and just purchased a WordPress theme then here’s how you can solve the load error: failed to find main.less in WordPress:

How to Solve load error failed to find main.less in WordPress

How to Solve load error: failed to find main.less in WordPress

Solve load error: failed to find main.less – Cherry Framework

If your theme uses Cherry Framework then you might get this error, especially if you want to move your WordPress site. Here’s how to solve load error: failed to find main.less if your theme has Cherry Framework:

What you have to do is quite simple, you only need to to delete the .cache files for .less files. Here’s where they’re usually located:

less/bootstrap.less.cache
less/style.less.cache

Then inside your child theme (if you’re using one) find the .cache files and delete them (if you’re still getting the error):

theme root/style.less.cache
bootstrap/less/bootstrap.less.cache

If you don’t delete these files, your website will look for the .less stylesheets and related files inside your old file structure (and that obviously won’t work).

Solve load error: failed to find main.less – Other themes

But what if your theme is not using Cherry Framework and you still got this error? Then there are couple of things that you can do to solve load error: failed to find main.less:

Delete the cache files

Go ahead and look around in your theme files. Also it’s not a bad idea to read your theme’s documentation (if you haven’t built it yourself). If you see a cache folder that’s created after you run your stylesheet, then delete it and try again. Also just in case – backup all your files before doing this.

Add FS_METHOD to wp-config file

Another thing to do is to add define( ‘FS_METHOD’, ‘direct’ ); in your wp-config file. What the constant FS_METHOD does is, it bypasses all of the WordPress’ recurring prompts, and it basically allows auto-updates of your files.

Sometimes this error happens when you’re on shared hosting and when WordPress is having a conflicts with ownership and permissions. By setting this method to ‘direct’, you’ll be able to upgrade or update your WordPress files and plugins to newer versions without having to provide any FTP details. Just add this line of code to your wp-config.php:

define( 'FS_METHOD', 'direct' );

After doing this, it’s good idea to regenerate your stylesheets. Just go to your admin and theme options, change some of the values in the styling options and save the settings. This should force regenerate your stylesheets.

Give permissions

When doing all of the things mentioned above, it’s also a good idea to provide WordPress with write access to the /wp-content folder. Just access your website’s FTP root file and change the folder file permissions (CHMOD) to 775 (or 777) rather than the default 755.

Increase your PHP memory

We’ve left this for last because it can be a bit tricky to do especially if you don’t have access to change the PHP version and to increase your PHP memory. If you have access to do this, make sure to increase your PHP memory and (if you want) to change the PHP version to higher one. If you can’t do this through your Control Panel, contact your host company and ask them to increase it for you. Sometimes they might not be willing to do this, especially if you’re on shared hosting, but it’s worth to try.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *