get( $id )['title']; return '' !== $stored ? esc_html( $stored ) : (string) $title; } public function print_description(): void { $id = self::product_id(); if ( 0 === $id ) { return; } $description = ( new CortexSeoAdapter() )->get( $id )['description']; if ( '' === $description ) { return; } printf( '' . "\n", esc_attr( $description ) ); } /** * The current product's id, or 0 when this isn't a product page or an SEO plugin owns the fields. */ private static function product_id(): int { if ( ! function_exists( 'is_product' ) || ! is_product() ) { return 0; } if ( 'cortexcommerce' !== SeoAdapters::detect()->id() ) { return 0; } return (int) get_queried_object_id(); } }