How to Stop Indexing Pagination Page Result without Plugins

Pagination is Functionality to open or browser more uploaded posts or item. Browser more items in website trough pagination.

Sometime search engine index duplicate content like page/2 or etc. If you want to stop indexing paginations result via functions.php so page given code in your active theme’s finctions.php file.

How to Stop Indexing page Result of WordPress Website/Blog

/*Add noindex to low value pages*/
function thekroyaard_stop_indexing_pagination(){
# Get page number for paginated archives.
$paged = intval( get_query_var( 'paged' ) );

# Add noindex tag to all archive, search and 404 pages.
if( is_archive() || is_search() || is_404() )
echo '<meta name="robots" content="noindex,follow">';

# Add noindex tag to homepage paginated pages.
if(( is_home() || is_front_page() ) && $paged >= 2 )
echo '<meta name="robots" content="noindex,follow">';
add_action('wp_head','thekroyaard_stop_indexing_pagination', 4 );

Then Save.