Taxonomy: Introduce the is_term_publicly_viewable() function.

This is the taxonomy term counterpart to the `is_post_publicly_viewable()` function. Although the logic for terms is more straight forward this serves the same purpose as introducing the corresponding function for posts -- to centralise and reduce the logic needed to validate a term and determine if it's publicly viewable.

Props peterwilsoncc, costdev, johnbillion

Fixes #56215

Built from https://develop.svn.wordpress.org/trunk@53893


git-svn-id: http://core.svn.wordpress.org/trunk@53452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn
2022-08-13 22:44:09 +00:00
parent e8a05d5082
commit 85306e1fd6
4 changed files with 23 additions and 4 deletions

View File

@@ -809,7 +809,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
);
} elseif ( 'term' === $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) {
$tax = get_taxonomy( $tag->taxonomy );
if ( is_taxonomy_viewable( $tax ) ) {
if ( is_term_publicly_viewable( $tag ) ) {
$wp_admin_bar->add_node(
array(
'id' => 'view',