您可以使用the_content 筛选以将代码直接添加到内容中。
add_filter( \'the_content\', \'wpse_202010_modify_the_content\' );
function wpse_202010_modify_the_content( $content ) {
  global $post;
  if ( in_array( $post->post_type, array( \'post\', \'page\' ) ) ) {
    $content = \'<p>New content here</p>\' . $content;
  }
  return $content;
}