好的,下面是我如何解析代码片段的,以防其他人需要知道
$id = get_the_ID();
$post = get_post( $id, ARRAY_A );
$yoast_title = get_post_meta( $id, \'_yoast_wpseo_title\', true );
$yoast_desc = get_post_meta( $id, \'_yoast_wpseo_metadesc\', true );
$metatitle_val = wpseo_replace_vars($yoast_title, $post );
$metatitle_val = apply_filters( \'wpseo_title\', $metatitle_val );
$metadesc_val = wpseo_replace_vars($yoast_desc, $post );
$metadesc_val = apply_filters( \'wpseo_metadesc\', $metadesc_val );
echo $metatitle_val;
echo "<br>";
echo $metadesc_val;