Last active
December 16, 2022 11:48
-
-
Save moskalukigor/41e51b675fd4bea2f90dabf76e365a12 to your computer and use it in GitHub Desktop.
update YoastSEO title and description with qTranslate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp', function(){ | |
global $wpdb; | |
$seo_title = "[:uk]TEST TITLE😜[:en]TEST TITLE😜[:]"; | |
$seo_description = "[:uk]Test description 👍[:en]Test description 👍[:]"; | |
$sql = "SELECT option_value FROM wp_options WHERE option_name = 'wpseo_taxonomy_meta'"; | |
$result = $wpdb->get_results($sql); | |
$result = $result[0]->option_value; | |
$result = unserialize($result); | |
//Where post_tag = $taxonomy & 123 = term_id | |
$result['post_tag'][123]['wpseo_title'] = $seo_title; | |
$result['post_tag'][123]['wpseo_desc'] = $seo_description; | |
$result = serialize($result); | |
$sql = "UPDATE wp_options SET option_value = '".$result."' WHERE option_name = 'wpseo_taxonomy_meta'"; | |
$wpdb->query($sql); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment