We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e5ea36 commit 9a77922Copy full SHA for 9a77922
source/wp-content/themes/wporg-showcase-2022/functions.php
@@ -461,7 +461,10 @@ function add_social_meta_tags() {
461
];
462
463
if ( is_tag() || is_category() ) {
464
- $og_fields['og:url'] = esc_url( get_term_link( get_queried_object_id() ) );
+ $queried_object_id = get_queried_object_id();
465
+ if ( $queried_object_id ) {
466
+ $og_fields['og:url'] = esc_url( get_term_link( $queried_object_id ) );
467
+ }
468
} elseif ( is_single() ) {
469
$og_fields['og:description'] = strip_tags( get_the_excerpt() );
470
$og_fields['og:url'] = esc_url( get_permalink() );
0 commit comments