Created
November 10, 2022 08:15
-
-
Save landjonathan/46120246a2fa286c65727f85f8e96914 to your computer and use it in GitHub Desktop.
Add shortcodes to Wordpress titles
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
// core WP titles | |
add_filter('the_title', 'do_shortcode'); | |
add_filter('wp_title', 'do_shortcode'); | |
// add to Yoast generated titles | |
// page title | |
add_filter('wpseo_title', 'do_shortcode'); | |
// schema -> webpage title | |
add_filter('wpseo_schema_webpage', function ($data) { | |
$data['name'] = apply_shortcodes($data['name']); | |
return $data; | |
}); | |
// og:title | |
add_filter('wpseo_opengraph_title', 'do_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment