Hreflang Tags WP
Smart implementation of HREFLANG meta tags for WordPress
by Skynets · github.com/skynetsfr/hreflang-tags-wordpress · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/skynetsfr/hreflang-tags-wordpress/archive/refs/heads/main.zipSmart implementation of HREFLANG meta tags into the head section of your WordPress site. Essential for multilingual and multi-regional websites to help search engines understand which language and regional variations of your content to serve to users.
Features
- Easy hreflang Management - Add and manage hreflang tags directly from the WordPress post editor
- Bulk Editor - Manage hreflang tags for multiple posts at once
- Taxonomy Support - Add hreflang tags to categories and custom taxonomies
- XML Sitemap - Generate hreflang-enabled XML sitemaps
- Validator - Built-in validation tool to check your hreflang implementation
- Tag Generator - Generate hreflang HTML code snippets
- REST API Support - Access and update hreflang data via WordPress REST API
- Security Hardened - CSRF protection, input sanitization, and permission checks throughout
- Free - No license keys, no restrictions
Installation
From GitHub
- Download the latest release from the releases page
- Upload the plugin folder to
/wp-content/plugins/ - Activate the plugin through the 'Plugins' menu in WordPress
- Configure the plugin settings under the 'Hreflang Tags WP' menu
Manual Installation
- Clone this repository:
git clone https://github.com/skynetsfr/hreflang-tags-wordpress.git - Upload to your
/wp-content/plugins/directory - Activate the plugin in WordPress
Usage
Basic Setup
- Navigate to Hreflang Tags WP in your WordPress admin menu
- Select which post types should have hreflang support
- Configure your default settings
Adding hreflang Tags to Posts
- Edit any post or page
- Scroll to the HREFLANG Tags meta box
- Add your alternate language URLs:
- Select the language code (e.g.,
en,fr,de) - Optionally select a region code (e.g.,
US,GB,CA) - Enter the alternate URL
- Select the language code (e.g.,
- Click the + button to add more languages
- Save your post
Using the Bulk Editor
- Go to Hreflang Tags WP → Bulk Editor
- View all posts with their hreflang tags
- Edit multiple entries at once
- Save changes in bulk
XML Sitemap Generation
- Go to Hreflang Tags WP → Sitemap
- Enable XML sitemap generation
- Click "Generate Sitemap"
- Your sitemap will be available at
yoursite.com/hreflang-tags-pro-sitemap.xml
REST API Usage
The plugin exposes hreflang data via the WordPress REST API:
GET Request
GET /wp-json/wp/v2/posts/{id}
Response includes:
{
"id": 123,
"title": "...",
"hreflang_tags": {
"en": "https://example.com/en/page",
"fr": "https://example.com/fr/page",
"es-ES": "https://example.com/es/page"
},
"html_lang": "en",
"html_region": "US"
}
POST/PUT Request
POST /wp-json/wp/v2/posts/{id}
Authorization: Bearer {token}
{
"hreflang_tags": {
"en": "https://example.com/en/new-page",
"fr": "https://example.com/fr/nouvelle-page"
}
}
Requirements
- WordPress 5.0 or higher
- PHP 7.0 or higher
What's New in 2.0.0
- Enhanced Security - Complete security audit with CSRF protection and input sanitization
- REST API Support - Full integration with WordPress REST API
- Improved Performance - Optimized code and reduced overhead
- Modern Standards - Updated to follow current WordPress development best practices
See CHANGELOG.md for detailed version history.
Security
Security is a top priority. Version 2.0.0 includes:
- CSRF token verification on all AJAX handlers
- Capability checks with
current_user_can() - Input sanitization with WordPress sanitization functions
- Output escaping to prevent XSS
- Path traversal protection on file operations
- SQL injection prevention with prepared statements
If you discover a security vulnerability, please email the details to the repository maintainer. Security issues will be addressed promptly.
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
Support
- Documentation: Check this README and the Wiki
- Issues: Report bugs or request features via GitHub Issues
- Discussions: Ask questions in GitHub Discussions
License
This project is licensed under the GPL v2 or later - see the LICENSE file for details.
Credits
Originally created by Vagary Digital. Now maintained and improved by Skynets as an open-source project.
Made with ❤️ for the WordPress multilingual community