Home > Article > Backend Development > Legacy WordPress web development workflow
Before you accept a project involving an existing WordPress website, ask yourself some important questions:
As you are still reading this article, I suspect that - despite having answered "no" or "I don't know" at least 1x - you are desperate enough or have other reasons like networking/marketing or hoping for a follow-up project and you have agreed to work with a legacy WordPress website that already starts to cause trouble.
We can reduce risks and troubles by using common sense and extra careful measures. Most importantly, always back up all data before making any changes!
What I do when I have to work with page builders to modify existing legacy websites:
Next:
Make a backup! UpdraftPlus is a good tool as its backups can be used for cloning WordPress websites, including purchased plugins, to development and staging systems.
Download the backup files to my local computer!
Setup a development instance! We can start with a 1-click-installation on shared hosting, or use a Docker-based template like wp_cli_docker for local development.
Restore/migrate the original content to your local copy. UpdraftPlus will adjust all absolute URLs and ensure a working media library on the target instance.
Reset the main admin user (either in wp-admin or using the mySQL cli inside the database Docker container) and change its email address.
Delete all other users!
Delete all personal and customer data!
Change the site title and the bookmark icon. My local development setups titles usually start with "Local" and the icons can't be confused with the production ones.
Update WordPress and its plugins in my local development instance.
Verify that everything still works!
Don't update any part of a client production site before creating and downloading a full backup, and don't do it before taking screenshots and saving archive examples! If anything breaks, we need to know the last working state!
Ask your client if they prefer an "under construction" or "maintenance mode" notice while you are making changes to their production site. Elementor has a built-in feature, but WordPress still hasn't, so we must rely on third-party plugins. I tried Under Construction which broke my localhost instance with a "white screen of death" due to a PHP deprecation message that shouldn't be fatal in production, but I still didn't want to risk it. Thanks to a hint on Team Streber's blog, I went for Maintenance by WebFactory Ltd, which seems good enough, at least for a short downtime, even without paying for PRO features.
copy the existing code to project files like custom.css, custom.js, example-child/functions.php and commit it.
Disable performance, caching, and security plugins locally before proceeding with the actual web development. They don't help while developing, but their optimization can get in our way, cause outdated page styles and waste memory and energy.
If we want to show our customer a preview to test, we can setup a public staging instance, transfer a new backup from localhost (which is already free from customer data and optional plugins), and set up password protection to make sure only the right people have access to our stage!
If we don't do staging, we can add a draft page on their production server where we can show some progress and make sure that we are really able to copy our work from localhost to production selectively.
Next, I try to find out how best to work with the given setup, how to persist my changes, and how to safely transfer them to another page or instance without breaking or forgetting anything.
As a web developer with a frontend focus, I try to use global CSS as much as possible. I know this contradicts the intention of no-code page builders, but so does coding in general. I found this to be a pragmatic compromise between staying in control of my code and not completely throwing away existing code and software.
Global custom CSS is prominent and easy to find compared to element-specific custom CSS or plugin-specific configurations that might stop working after the next major update.
Depending on the website's complexity and our experience with its technologies, we might have spent at least half an hour or the whole day getting a grip on a legacy setup without any visible achievement. Before we start coding, we should review our assignment and find an easy subtask to begin with, ideally something that causes a change that is obvious at first sight.
So we can finish our first hour or day of work with a feeling of achievement.
When proceeding with our work, we must stay careful.
As you can see, I keep posting about WordPress. I keep taking on clients with legacy WordPress websites, and I don't rewrite their code from scratch. I hope that my hints and rants turn out to be helpful for anyone. Publishing this kind of post is another way to preserve my knowledge and find it the next time I google an error message.
The above is the detailed content of Legacy WordPress web development workflow. For more information, please follow other related articles on the PHP Chinese website!