Overview
TheGeoAI_Meta class manages all meta tag output in the website head section. It handles SEO titles, meta descriptions, robots directives, and canonical URLs. The class respects compatibility mode to avoid conflicts with other SEO plugins.
Namespace: GeoAI\Core
Location: includes/class-geoai-meta.php
Key Features
- Custom SEO title output
- Meta description generation
- Robots meta tag control
- Canonical URL management
- Template variable parsing
- Post editor meta box
- Compatibility mode support
Public Methods
get_instance()
Returns the singleton instance of the meta class.GeoAI_Meta - The singleton instance
Example:
filter_title()
Filters the document title with custom SEO title.The original document title
string - Filtered title or original if no custom title set
Hooks: pre_get_document_title
Example:
output_meta_tags()
Outputs meta tags in the website head section.wp_head (priority 1)
Outputs:
meta name="description"- Meta descriptionmeta name="robots"- Robots directiveslink rel="canonical"- Canonical URL
add_meta_box()
Adds GEO AI SEO meta box to post editor screens.add_meta_boxes
Added to: All public post types (posts, pages, custom post types)
Position: Normal, High priority
render_meta_box()
Renders the SEO meta box content in post editor.The post object being edited
- SEO Title (max 70 characters)
- Meta Description (max 165 characters)
- Robots Meta (dropdown)
- AI Generate button
save_meta_box()
Saves meta box data when post is saved.The post ID being saved
save_post
Security:
- Nonce verification
- Autosave check
- Capability check
Template Variables
The following variables can be used in title and meta templates:Available Variables
Post or page title
Site name from WordPress settings
Site tagline/description
Separator character (default: |)
Post excerpt
Post publish date
Post modified date
Post ID
Post author name
Template Examples
Post Meta Keys
Stored Meta Data
Custom SEO title for the post
Custom meta description for the post
Robots meta directives (e.g., “noindex,follow”)
Reading Meta Data
Updating Meta Data
Robots Meta Options
Available Directives
Empty value, uses default behavior (index, follow)
Prevent indexing but allow following links
Allow indexing but don’t follow links
Prevent indexing and don’t follow links
Usage Examples
Get Current Page Title
Set Custom Meta for Post
Noindex a Post
Get Meta Description with Fallback
Custom Template Variables
Extend available variables with a filter:Compatibility Mode
The class checks compatibility mode before outputting meta tags:Character Limits
Recommended Lengths
50-60 characters (max 70) to avoid truncation in search results
150-160 characters (max 165) for optimal display in SERPs
Live Character Counter
The meta box includes JavaScript character counters that update in real-time:Meta Box Features
AI Generation Integration
The meta box includes an “Generate with AI” button that:- Sends AJAX request to
geoai_generate_metaaction - Receives optimized title and description from Gemini API
- Auto-fills the meta fields
- Shows success/error status
JavaScript Events
Related Classes
- GeoAI_Admin - Admin interface and meta box rendering
- GeoAI_Analyzer - AI-powered meta generation
- GeoAI_Compat - SEO plugin compatibility
- GeoAI_Social - Social media meta tags