Support » Plugin: Jetpack - WP Security, Backup, Speed, & Growth » How to update Twitter Cards meta?
How to update Twitter Cards meta?
-
The latest 2.4 version added Twitter Cards meta tags to OpenGraph. How do you update the twitter:site meta tag?
It currently is set to @jetpack???
<meta name=”twitter:site” content=”@jetpack” />
-
You can customize this value by adding the following code to your theme’s functions.php file:
function tweakjp_custom_twitter_site( $og_tags ) { $og_tags['twitter:site'] = '@jeherve'; return $og_tags; } add_filter( 'jetpack_open_graph_tags', 'tweakjp_custom_twitter_site', 11 );
You’ll have to replace my twitter username with your own, of course 🙂
Perfect, worked great. Thank you!
I have same problem i put this code :
function tweakjp_custom_twitter_site( $og_tags ) { $og_tags['twitter:site'] = '@techsou'; return $og_tags; } add_filter( 'jetpack_open_graph_tags', 'tweakjp_custom_twitter_site', 11 );
In function of the theme, When i put it i can’t enter to my wp-admin !!!
Please help
Techsou, try copying the code out by hand (not copy paste) in your theme’s functions.php file. Sometimes an errant space or tab character gets copied by copy-paste and can cause issues.
Let me know if you still have problems with it.
Same Problem, But when i use Twitter Card Meta Plugin it’s working fine !
@cris If you’re not happy with the default value, and if you don’t feel comfortable editing PHP code, you can install another Twitter Card plugin, as @techsou mentioned earlier. As soon as you install another Twitter Card plugin, the Jetpack Twitter Cards will disappear and let the other plugin handle things.
I agree though,
@jetpack
might not be the best choice for everyone. We’re continuously working on improving Jetpack, and we’re thinking on ways to let you customize this value without having to touch code.Thanks for the feedback!
i guess what i’m trying to say (and correct me if i’m wrong), is that i should be able to turn off portions (and all) of the extra stuff added to the code, such as the OpenGraph tags.
I’m pretty new to Jetpack, but have used it a bit. I went through the modules and didn’t fine one _specific_ option to disable the twitter meta cards, for example.
By just looking at your example code I can see that I will probably be able to maybe unset some opengraph tags, and viola.
However, it should be easily disabled via the gui so I don’t have to add a custom plugin or modify my theme to support jetpack in that aspect.
By just looking at your example code I can see that I will probably be able to maybe unset some opengraph tags, and viola.
You can indeed use a filter to disable Twitter Cards, like so:
add_filter( 'jetpack_disable_twitter_cards', '__return_true', 99 );
However, it should be easily disabled via the gui so I don’t have to add a custom plugin or modify my theme to support jetpack in that aspect.
We try to stick to WordPress’ core principles and philosophy as much as possible. That’s why we sometimes decide to make a decision for the majority of the users, instead of adding one more option. We do however, do our best to provide filters so people can change the default behaviour with an extra plugin, or a few lines of code in their theme’s functions.php file.
- The topic ‘How to update Twitter Cards meta?’ is closed to new replies.