您只需将过滤器添加到the_content
就像这样:
function wpse_337486( $content ) {
if ( is_single() ) {
// Get the current post.
global $post;
// Get all post tags. Get only their names.
$tags = wp_get_post_tags($post->ID, [\'fields\' => \'names\']);
// Append post tags to content.
$content = $content . \' \' . implode(\' \', $tags);
}
return $content;
}
add_filter( \'the_content\', \'wpse_337486\' );