WordPress函数文档do_trackbacks()
调用do_trackbacks的hook钩子 描述 译文 执行trackbacks 原文 Perform tr…
调用do_trackbacks的hook钩子
描述
译文
执行trackbacks
原文
Perform trackbacks.
用法
<?php do_trackbacks( $post_id ) ?>
参数
$post_id
(integer) (必填) Post ID to do trackbacks on.
默认值: None
返回值
(void)
This function does not return a value.
注意
- See Reads from and may update the _posts table from the database.
- 使用到 global: (object) $wpdb
- 使用到: get_to_ping()
- 使用到: get_pung()
- 使用到: wp_html_excerpt()
- 使用到: apply_filters() on ‘the_content’ on ‘post_content’
- 使用到: apply_filters() on ‘the_excerpt’ on ‘post_excerpt’
- 使用到: apply_filters() on ‘the_title’ on ‘post_title’
- 使用到: trackback()
历史
添加于 版本: 1.5.0
源文件
do_trackbacks() 函数的代码位于 wp-includes/comment.php
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
/**
* Perform trackbacks.
*
* @since 1.5.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int $post_id Post ID to do trackbacks on.
*/
function do_trackbacks($post_id) {
global $wpdb;
$post = get_post( $post_id );
$to_ping = get_to_ping($post_id);
$pinged = get_pung($post_id);
if ( empty($to_ping) ) {
$wpdb->update($wpdb->posts, array(‘to_ping’ => ”), array(‘ID’ => $post_id) );
return;
}
if ( empty($post->post_excerpt) ) {
/** This filter is documented in wp-includes/post-template.php */
$excerpt = apply_filters( ‘the_content’, $post->post_content, $post->ID );
} else {
/** This filter is documented in wp-includes/post-template.php */
$excerpt = apply_filters( ‘the_excerpt’, $post->post_excerpt );
}
$excerpt = str_replace(‘]]>’, ‘]]>’, $excerpt);
$excerpt = wp_html_excerpt($excerpt, 252, ‘…’);
/** This filter is documented in wp-includes/post-template.php */
$post_title = apply_filters( ‘the_title’, $post->post_title, $post->ID );
$post_title = strip_tags($post_title);
if ( $to_ping ) {
foreach ( (array) $to_ping as $tb_ping ) {
$tb_ping = trim($tb_ping);
if ( !in_array($tb_ping, $pinged) ) {
trackback($tb_ping, $post_title, $excerpt, $post_id);
$pinged[] = $tb_ping;
} else {
$wpdb->query( $wpdb->prepare(“UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, ”)) WHERE ID = %d”, $tb_ping, $post_id) );
}
}
}
}
|
- 原文:http://codex.wordpress.org/Function_Reference/do_trackbacks
类别:WordPress函数文档、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!