get_enclosed()
get_enclosed( int $post_id ) 检索已封闭的邮件附件。Retrieve enclos…
get_enclosed( int $post_id )
检索已封闭的邮件附件。
Retrieve enclosures already enclosed for a post.
目录锚点:#参数#返回#源码
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $post_id | (int) | 必需 | 邮政编码。 |
返回(Return)
(string[])给定post的存储模块数组。
源码(Source)
/**
* Retrieve enclosures already enclosed for a post.
*
* @since 1.5.0
*
* @param int $post_id Post ID.
* @return array List of enclosures.
*/
function get_enclosed( $post_id ) {
$custom_fields = get_post_custom( $post_id );
$pung = array();
if ( !is_array( $custom_fields ) )
return $pung;
foreach ( $custom_fields as $key => $val ) {
if ( 'enclosure' != $key || !is_array( $val ) )
continue;
foreach( $val as $enc ) {
$enclosure = explode( "
", $enc );
$pung[] = trim( $enclosure[ 0 ] );
}
}
/**
* Filter the list of enclosures already enclosed for the given post.
*
* @since 2.0.0
*
* @param array $pung Array of enclosures for the given post.
* @param int $post_id Post ID.
*/
return apply_filters( 'get_enclosed', $pung, $post_id );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 1.5.0 | wp-includes/post.php:4751 | 1 function | 3 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!