WordPress CORS Error Trying to load assets from old domain after migration.

WordPress

I did a lot of WordPress development and optimizations. So for my testing and development I’m using my local development environment built with WSL with nginx, php and mariadb.

As you already knew we need to run a few fixes on the db to get wordpress loading from our local domain. For my migrations i use the wonderful WP Migrate DB Pro (you can also do it by yourself as written here), but while it fixed almost everything for me one damn thing was left unchanged. Basically, my theme was still trying to load fonts and images from the production server and so failing because of CORS an Access Control Allow Origin error.

After a few text search in my db I discovered that inside the table wp_options a wp_less_cached_files record with the cached less file!!

So the fix was very simple and quick by just issuing the following delete statement.

DELETE FROM wp_options WHERE option_name='wp_less_cached_files'

And voila! If you reload your page it should now be loading your resources from your local setup.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Sebastian Faltoni

Software Architect. Passionate about Clean Code, Tech, Web, AI, .NET, Python, IOT and now Blazor

%d bloggers like this: