Last active
August 18, 2019 04:52
-
-
Save freddielore/fbf3e3311c33143d74ea47f9ad3b59b8 to your computer and use it in GitHub Desktop.
[smart_seo_export_title_v2] smart_seo_export_title usage example #wordpress #genesis #seo
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_filter( 'smart_seo_export_title', 'demo_export_default_seo_titles_v2', 8, 2 ); | |
function demo_export_default_seo_titles_v2( $title, $post ){ | |
// if no custom SEO title being defined, get global defaults for Yoast | |
if( class_exists('WPSEO_Option' ) && empty($title) ){ | |
$settings = get_option( 'wpseo_titles' ); | |
$replacer = new WPSEO_Replace_Vars(); | |
$title = $replacer->replace( $settings['title-' . $post->post_type], $post ); | |
} | |
return $title; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment