Search
 
SCRIPT & CODE EXAMPLE
 

PHP

x-default wpml canonical alternate hreflang

/* ---------------------------------------------------------------------------
 * Set hreflang="x-default" with WPML
 * --------------------------------------------------------------------------- */
// SEOPress adds a filter with default prio (10) which returns false if an article is set to "noindex"
// In this case, don't add the x-default tag!
add_filter('wpml_hreflangs', 'wpml_hreflangs_add_xdefault', 20, 1);
function wpml_hreflangs_add_xdefault($hreflang_items) {
    if (is_array($hreflang_items)) {
        foreach ($hreflang_items as $hreflang_code => $hreflang_url) {
            if($hreflang_code == apply_filters('wpml_default_language', NULL)) {
                echo PHP_EOL.'<link rel="alternate" hreflang="x-default" href="' .$hreflang_url . '" />'.PHP_EOL;
            }
        }
    }
    return $hreflang_items;
}
Comment

PREVIOUS NEXT
Code Example
Php :: get product price with thousands separator 
Php :: composer require laravelcollection 
Php :: failed to delete data in mysqli using php 
Php :: how to auto increment id after delete value in php mysql 
Php :: not have permision elgg settings.php 
Php :: how to fix 419 page expired in laravel 
Php :: laravel best practices tutorial 
Php :: is_wplogin 
Php :: command line that convert html to php file 
Php :: php google authenauthenticator 
Php :: GZIP COMPRESSION With PHP 
Php :: Laravel route returning error 404 when attempt is made to pass value to controller function 
Php :: How to increase the WordPress Multisite Network limit for Maximum Filesize Upload? 
Php :: use middleware in controller to have access session 
Php :: changing the autoload.php for algolia search 
Php :: how to make diffrent php pages have diffrent styles 
Php :: php: foreach loop 
Php :: php code obfuscator 
Php :: php associative array 
Php :: product slider shortcode woocommerce 
Php :: php catch mysqli_connect(): (HY000/1045): Access denied 
Php :: how to do taxonomy filter in wordpress 
Php :: php get final redirect url 
Php :: tackel discount in javascript 
Java :: import math java 
Java :: spring boot maven run with profile 
Java :: create a random char java 
Java :: spigot how to create custom items 
Java :: return boolean value from stream 
Java :: java remove List null element 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =