Code to “noindex” Specific WordPress Post

/* Noindex Specific WordPress Post */
add_action('wp_head', 'wpflt_header_function_condition_noindex_post_single');
function wpflt_header_function_condition_noindex_post_single(){
if ( is_single( '1889' ) ) { ?>
<meta name="robots" content="noindex" />
<?php }
};

Here is a simple filter to add ‘noindex’ metatag to specific posts in WordPress. Enter post ID of the specific post in Line 4. Confirm the tag in the Source Code.