使用the_content
筛选以将字段添加到的输出中the_content()
功能:
function wpd_content_filter( $content ) {
if ( \'your_custom_type\' == get_post_type() ){
if( $meta = get_post_meta( get_the_ID(), \'foo_meta\', true ) ) {
$content = $content . $meta;
}
}
return $content;
}
add_filter( \'the_content\', \'wpd_content_filter\' );