How To Optimize WP-Cron And Why You Should
In this tutorial, we’re going to walk through how to optimize your website for better performance, especially if you’re on a shared hosting plan. And a shared hosting plan just means that you’re sharing your website resources with other users on the same server.
A lot of people cannot afford to pay for their server or a VPN so it’s just less expensive to just go ahead and purchase a shared hosting plan, especially if you have limited funds. But as your website grows, it starts to get bigger, get more traffic, you may want to go toward a VPN, but that’s just somewhere down the line. The way we optimize your website for better performance is by adding a piece of code in your WP config file.
To do this, you will need access to your Cpanel and as always make sure you backup your website. Okay so now we’re in the cPanel Dashboard.
1. Scroll down and find file manager and right-click on it. Make sure the website you’re working on is selected and click show hidden files.
2. Next, look at your files and find wpconfig.php. Click on it once and click edit at the top. We are going to enter this piece of code in your WP config file.
3. Ok so find the heading that says “Database Collate, Don’t change this” and paste that code right under that heading. What this does is disable the wp-cronWP-Cron file.
4. But you don’t want to leave it here. What you are going to do is schedule your cron job to run. A million cron jobs are run every second so we are going to prevent this.
5. Go back to your cPanel Admin area to schedule your cron jobs.
6. Scroll down to the bottom to advance and click on cross WP-Cronjob. What we want to do is schedule cron job to run every four to six hours vs every few seconds. And we’re going to select once per hour. Next set it to run every six hours.
7. Next ad this piece of code to tell cron to run this job. And click save.
Still not sure if social advertising is for you? Get in touch, we will be happy to answer any questions you may have.