SUPPORT CHAT SKYPE 888.321.HOST(4678)
WEB HOSTING DOMAINS WEB DESIGN SITE HOSTING TOOLS MEET US AMP LOGIN
SUPPORT CENTER
How may we help? SEARCH
Support Center Website WordPress Disabling the wp-cron.php in WordPress
>> >> >>
Disabling the wp-cron.php in WordPress
Written by Jacob Nicholson Views: 113,461 Published: Dec 9, 2015 Comments: 86
WordPress version 4.4 has been released! Click here for more information on the updates and features in
WordPres 4.4!
Disabling wp-cron.php in WordPress
WordPress uses a file called wp-cron.php as a virtual cron job, or scheduled task in order to automate things like
publishing scheduled posts, checking for plugin or theme updates, sending email notifications and more.
By default WordPress is setup to call wp-cron.php everytime someone visits your WordPress website when a scheduled
task is present, to basically ask "is it time to do anything yet?".
On low traffic sites this is perfectly fine, but when visitors roll in, checking multiple times for scheduled tasks can be very
inefficient and lead to resource usage problems for your server, plus make your website load slower.
Disable default wp-cron.php behavior
We can easily tell WordPress to let us handle the execution of wp-cron.php with the wp-config.php file.
Step 1. Open your wp-config.php file with the cPanel File Manager Code Editor
Step 2. Go to the bottom of the database settings in wp-config.php typically around line 37.
Add the code below highlighted in red:
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
define('DISABLE_WP_CRON', 'true');
Step 3. Click Save
Now WordPress will not automatically run the wp-cron.php script each time your site gets a new visitor.
Setup manual cron job for wp-cron.php
We don't want to leave WordPress without any ability to automate tasks it might need to do. But at least now that it's not
running for every single visitor, we can have way more control over when these tasks take place.
For most WordPress users having the wp-cron.php script run every 6 hours is perfectly fine. That would be just 4
executions in a day, compared to possibly hundreds, or even thousands if you had a lot of website traffic that day.
Step 1. Log into cPanel
Step 2. Under the Advanced section, click on Cron Jobs.
Step 3. Select Once an hour from the Common Settings drop-down.
Step 4. Now select Every 6 hours from the Hour drop-down.
Step 5. Finally fill in the code to run our cron job and click Add New Cron Job.
cd /home/userna5/public_html; php q wp cron.php
Where userna5 is your cPanel user name.
Keep in mind that the /home/userna5/public_html path would be for a
primary domain, if you're using an addon domain, or have WordPress installed
in a sub-directory you'll want to be sure to update your path.
Step 6. You should see that your new cron job was added successfully.
Now your WordPress website should be safely running scheduled tasks via the wp-cron.php script, but only at set
intervals. If you aren't receiving an email when the cron runs, see our guide on cron job not emailing me.
Wyszukiwarka
Podobne podstrony:
Brandy Corvin Howling for the Vampire2002 09 Creating Virtual Worlds with Pov Ray and the Right Front EndUsing the Siemens S65 Display2007 01 Web Building the Aptana Free Developer Environment for AjaxBeyerl P The Symbols And Magick of TarotIn the?rnThe Best Way to Get Your Man to Commit to YouFringe S03E03 The Plateau HDTV XviD LOL04 How The Heart Approaches What It YearnsMiddle of the book TestA Units 1 7Ghost in the Shell 2 0 (2008) [720p,BluRay,x264,DTS ES] THORAwięcej podobnych podstron