“Function Reference/wp cron”的版本间的差异

来自WordPress中文文档
跳转至: 导航搜索
(1个修订)
(1个版本)
 
(未显示3个用户的3个中间版本)
第1行: 第1行:
 
== Description ==
 
== Description ==
 +
 
Run scheduled callbacks or spawn cron for all scheduled events.  
 
Run scheduled callbacks or spawn cron for all scheduled events.  
  
 
== Usage ==
 
== Usage ==
%%%?php wp_cron() ?%%%
+
 
 +
%%%<?php wp_cron() ?>%%%
  
 
== Parameters ==
 
== Parameters ==
 +
 
None.
 
None.
  
 
== Return Values ==
 
== Return Values ==
; (null) : When doesn't need to run Cron.
+
 
 +
; (null) : When cron doesn't need to run..
  
 
== Examples ==
 
== Examples ==
!-- Need creative examples. Feel free to link to external examples. --
+
 
 +
<pre>
 +
if ( ! wp_next_scheduled( 'my_task_hook' ) ) {
 +
  wp_schedule_event( time(), 'hourly', 'my_task_hook' );
 +
}
 +
 
 +
add_action( 'my_task_hook', 'my_task_function' );
 +
 
 +
function my_task_function() {
 +
  wp_mail( 'your@email.com', 'Automatic email', 'Automatic scheduled email from WordPress.');
 +
}
 +
</pre>
  
 
== Notes ==
 
== Notes ==
 +
 
* Cron is named after a unix program which runs unattended scheduled tasks.
 
* Cron is named after a unix program which runs unattended scheduled tasks.
  
 
== Change Log ==
 
== Change Log ==
Since: 2.1.0
+
 
 +
* Since: [[Version 2.1|2.1.0]]
  
 
== Source File ==
 
== Source File ==
!-- Need links to current source code files --
+
 
ttwp_cron()/tt is located in ttwp-includes/cron.php/tt.
+
<tt>wp_cron()</tt> is located in {{Trac|wp-includes/cron.php}}.
  
 
== Related ==
 
== Related ==
!--
+
* [[Function_Reference/wp_schedule_event|wp_schedule_event]]
    To Do:
+
{{Tag Footer}}
    Need to find related functions.
 
    Need to create groups of functions and create templates to add them to a page quickly.
 
    Some functions may be related to many groups of functions.
 
--
 
 
 
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:New_page_created]]
+
[[Category:WP-Cron Functions]]

2013年8月2日 (五) 04:22的最新版本

Description

Run scheduled callbacks or spawn cron for all scheduled events.

Usage

%%%<?php wp_cron() ?>%%%

Parameters

None.

Return Values

(null) 
When cron doesn't need to run..

Examples

if ( ! wp_next_scheduled( 'my_task_hook' ) ) {
  wp_schedule_event( time(), 'hourly', 'my_task_hook' );
}

add_action( 'my_task_hook', 'my_task_function' );

function my_task_function() {
  wp_mail( 'your@email.com', 'Automatic email', 'Automatic scheduled email from WordPress.');
}

Notes

  • Cron is named after a unix program which runs unattended scheduled tasks.

Change Log

Source File

wp_cron() is located in onlyincludecodewp-includes/cron.php/code/onlyinclude

div class=template-description style=padding: 0 1.5em; border: 1px solid #eeeeee; background-color: #f9f9f9

Template Description

Link to the source code on http://core.trac.wordpress.org/browser/.

Parameters

  1. filename
  2. (option) path to codetag/code (version) or codetrunk/code. This option is only used for a new function.br /Default: codetrunk/code -- trunk is the latest bleeding edge development version of WordPress.

Usage

Link to the stable version: pre检查到模板循环:模板:Trac/pre

Link to trunk: pre检查到模板循环:模板:Trac/pre

/div

wordpress.org.cn.

Related

includeonlydiv style=clear:both; background-color:#F7F7F7; border:1px solid #CCCCCC; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;See also index of Function Reference and index of Template Tags./div/includeonlynoinclude

Description

This Template is used by Codex:Template Messages.

Usage

pre 检查到模板循环:模板:Message /pre

Result

检查到模板循环:模板:Message

/noinclude