solutionweb

WordPress Common Errors and Solutions

WordPress code to achieve article content update tips detailed tutorial

Recently, when I was working on a project, I encountered a small demand. When the content of the article was updated, I needed a striking reminder. After a little thinking, wordpress has a record of the update time. Just compare the release time with the update time, and then make a limit to perfectly realize the wordpress article update prompt.

Add the following code to functions.php,

function is_modified(){

global $post;
$punish_time = get_the_date(‘U’);
$modified_time = get_the_modified_date(‘U’);
$time = time();
if( ( $modified_time > $punish_time) && ( $time – $modified_time < 3600*24*7 ) ) return true; } Then call it in the loop.
The content of this article has been updated

Back to top