Skip to content

Instantly share code, notes, and snippets.

@freddielore
Last active August 18, 2019 04:52
Show Gist options
  • Save freddielore/fbf3e3311c33143d74ea47f9ad3b59b8 to your computer and use it in GitHub Desktop.
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
<?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