# yatra/3.0.14.2/includes/seo-helper.php

Yatra – Travel Booking &amp; Tour Operator Software, version 3.0.14.2. 87 lines.

- Page: https://pluginprobe.com/plugins/yatra/3.0.14.2/code/includes/seo-helper.php
- Raw: https://pluginprobe.com/plugins/yatra/3.0.14.2/raw/includes/seo-helper.php
- Modified: 2026-04-27T10:22:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/yatra/3.0.14.2/code/includes/seo-helper.php#L10-L20`.

```php
<?php
/**
 * Yatra SEO Helper Functions
 * 
 * Production-ready clean SEO implementation using the new SEOService architecture.
 * All new SEO functionality should use SEOService and SEOManager directly.
 * 
 * @package Yatra
 */

/**
 * Helper function to get SEO title for current page
 * Useful for manual calls or custom implementations
 * 
 * @return string The SEO title for current page
 * @throws \InvalidArgumentException If SEO manager is not available
 */
function yatra_get_seo_title(): string {
    try {
        if (!class_exists('\Yatra\Managers\SEOManager')) {
            throw new \InvalidArgumentException('SEO Manager not available');
        }
        
        return \Yatra\Managers\SEOManager::filterDocumentTitle('');
    } catch (\Exception $e) {
         
        return '';
    }
}

/**
 * Helper function to output SEO meta tags for current page
 * Useful for manual calls or custom implementations
 * 
 * @return void
 * @throws \InvalidArgumentException If SEO manager is not available
 */
function yatra_output_seo_meta_tags(): void {
    try {
        if (!class_exists('\Yatra\Managers\SEOManager')) {
            throw new \InvalidArgumentException('SEO Manager not available');
        }
        
        \Yatra\Managers\SEOManager::outputSEOMetaTags();
    } catch (\Exception $e) {
        // Fail silently to avoid breaking page rendering
    }
}

/**
 * Helper function to get SEO service for specific page type and object
 * Useful for custom SEO implementations
 * 
 * @param string $pageType The page type
 * @param mixed $pageObject The page object
 * @return \Yatra\Services\SEOService The SEO service instance
 * @throws \InvalidArgumentException If SEO service is not available or page type is invalid
 */
function yatra_get_seo_service(string $pageType, $pageObject = null): \Yatra\Services\SEOService {
    try {
        if (!class_exists('\Yatra\Services\SEOService')) {
            throw new \InvalidArgumentException('SEO Service not available');
        }
        
        // Validate page type
        $validTypes = [
            \Yatra\Services\SEOService::PAGE_TYPE_TRIP,
            \Yatra\Services\SEOService::PAGE_TYPE_TRIP_ARCHIVE,
            \Yatra\Services\SEOService::PAGE_TYPE_DESTINATION,
            \Yatra\Services\SEOService::PAGE_TYPE_ACTIVITY,
            \Yatra\Services\SEOService::PAGE_TYPE_CATEGORY,
            \Yatra\Services\SEOService::PAGE_TYPE_DESTINATION_LISTING,
            \Yatra\Services\SEOService::PAGE_TYPE_ACTIVITY_LISTING,
            \Yatra\Services\SEOService::PAGE_TYPE_CATEGORY_LISTING,
        ];
        
        if (!in_array($pageType, $validTypes, true)) {
            throw new \InvalidArgumentException('Invalid page type: ' . $pageType);
        }
        
        return \Yatra\Services\SEOService::forPage($pageType, $pageObject);
    } catch (\Exception $e) {
         
        throw $e;
    }
}

```
