Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abdulawal39/21b6dcd1a2abac3007593b5ad0d855dd to your computer and use it in GitHub Desktop.
Save abdulawal39/21b6dcd1a2abac3007593b5ad0d855dd to your computer and use it in GitHub Desktop.
Use this code in your active theme's functions.php file.
function tncpvfw_support_disable_pdfviewer_archive_and_hide_from_google($args, $post_type) {
if ($post_type === 'pdfviewer') {
$args['has_archive'] = false;
}
return $args;
}
add_filter('register_post_type_args', 'tncpvfw_support_disable_pdfviewer_archive_and_hide_from_google', 10, 2);
function tncpvfw_support_add_noindex_meta_tag() {
echo '<meta name="robots" content="noindex, nofollow" />';
}
add_action('tnc_pvfw_head', 'tncpvfw_support_add_noindex_meta_tag');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment