Skip to content

Instantly share code, notes, and snippets.

@seanlanglands
Last active March 15, 2023 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanlanglands/aa7685668c259d30b86d5ec0c41c989e to your computer and use it in GitHub Desktop.
Save seanlanglands/aa7685668c259d30b86d5ec0c41c989e to your computer and use it in GitHub Desktop.
<?php
/**
* Overwrite default post_tag taxonomy to be non-public.
*
* @see https://developer.wordpress.org/reference/functions/register_taxonomy/
*
* @return void
*/
function vip_modify_post_tag_taxonomy() {
$post_tag_args = get_taxonomy( 'post_tag' );
$post_tag_args->public = false;
$post_tag_args->publicly_queryable = false;
register_taxonomy( 'post_tag', 'post', $post_tag_args );
}
add_action( 'init', 'vip_modify_post_tag_taxonomy', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment