Home > Article > CMS Tutorial > How to automatically publish articles in WordPress
WordPress has the function of publishing articles regularly. In the publishing interface, there is a button to publish and edit the article immediately. Click here to edit when the article was published.
Therefore, we can set a time to publish an article at a specific time:
Why do we need to publish articles regularly? What are the advantages and disadvantages of publishing regularly? Why do we need to use WordPress’s scheduled posting function? Publishing articles at a fixed time is a very good experience for search engines and user experience.
Because if our website updates articles with a certain pattern, it will be a good experience for both search engines and users.
Because regular updates can let users and search engines know when you will release new content, instead of publishing it irregularly, so that users and search engines can easily find it. Your new content is more user-friendly.
Therefore, regardless of whether you use scheduled publishing, it is better to publish articles in a specific time period, but if you use scheduled publishing, it will give us great convenience.
Solution to the problem of WordPress scheduled publishing failure
Sometimes when we use WordPress to schedule publishing, the publishing will fail. This is because WordPress’s default publishing time is 0.01 seconds. Once If the time is exceeded without successful publishing, scheduled article publishing will fail.
So how do we solve this problem?
The following introduces 2 methods to solve the problem. The first method is to change the wordpress source file:
Method 1: Modify the /wp-includes/cron.php system file
Open the cron.php file under the wp-includes directory and find the "timeout" code:
wp_remote_post( $cron_url, array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) ) );
Just change the value 0.01 at the end of the code to be larger than 0.01, or you can change it to 10.00.
Such a modification can solve the problem, but if wordpress is updated, we need to modify it again, which is more troublesome.
If we don’t want so much trouble, then we can use a plug-in to solve this problem:
Search for WP Missed Schedule in the wordpress background-plug-in-install plug-in and install it. solve this problem.
For more wordpress related technical articles, please visit the wordpress tutorial column to learn!
The above is the detailed content of How to automatically publish articles in WordPress. For more information, please follow other related articles on the PHP Chinese website!