Skip to content

Commit 53e18ee

Browse files
Merge pull request #1093 from cloudinary/fix/get_taxonomy
Fix Tax Labels Warning
2 parents 33f3f6c + 414cdeb commit 53e18ee

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

php/templates/taxonomy-transformation-fields.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,24 @@
1313

1414
wp_add_inline_script( 'cloudinary', 'var CLD_GLOBAL_TRANSFORMATIONS = CLD_GLOBAL_TRANSFORMATIONS ? CLD_GLOBAL_TRANSFORMATIONS : {};', 'before' );
1515

16-
$tax_slug = Utils::get_sanitized_text( 'taxonomy' );
17-
$tax_labels = get_taxonomy_labels( get_taxonomy( $tax_slug ) );
16+
$tax_slug = Utils::get_sanitized_text( 'taxonomy' );
17+
18+
if ( empty( $tax_slug ) ) {
19+
return;
20+
}
21+
22+
$current_taxonomy = get_taxonomy( $tax_slug );
23+
24+
if ( ! $current_taxonomy instanceof WP_Taxonomy ) {
25+
return;
26+
}
27+
28+
$tax_labels = get_taxonomy_labels( $current_taxonomy );
29+
30+
if ( empty( $tax_labels ) ) {
31+
return;
32+
}
33+
1834
$cloudinary = get_plugin_instance();
1935
?>
2036
<div class="cloudinary-collapsible">

0 commit comments

Comments
 (0)