以下是我的功能:
function insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url )
{
$postID = ???
$rel = "<a rel=\'shadowbox[".$postID."]\'";
if ($url) {$html = str_replace("<a",$rel,$html);}
return $html;
}
add_filter( \'image_send_to_editor\', \'insert_img_rel_attrib\', 10, 6 );
如何获取当前帖子ID?我试过显而易见的,
global $wp_query;
$postID = $wp_query->post->ID;
等