Skip to content

Instantly share code, notes, and snippets.

@freddielore
Created August 18, 2019 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freddielore/78c5e60555a7b88c3d664752b5068630 to your computer and use it in GitHub Desktop.
Save freddielore/78c5e60555a7b88c3d664752b5068630 to your computer and use it in GitHub Desktop.
[smart_seo_export_title] smart_seo_export_title filter demo #wordpress #wp #seo
add_filter( 'smart_seo_export_title', 'demo_export_default_seo_titles', 8, 2 );
function demo_export_default_seo_titles( $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' );
$title = $settings['title-' . $post->post_type];
}
return $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment