Jeremy Herve Avatar

That’s me. And my blog. In English and in French.


Jetpack: change og:title value to be all uppercase

Caps Lock

Some blog owners would like their post titles to be displayed in all caps, to attract more clicks on Facebook. Here is how to change Jetpack’s Open Graph meta tags to use an uppercase og:title tag:

/**
 * Plugin Name: Uppercase og:title for Jetpack
 * Plugin URI: http://wordpress.org/extend/plugins/jetpack/
 * Description: Removes Jetpack's default og:title tag, and replaces it with an uppercase og:title
 * Author: Jeremy Herve
 * Version: 1.0
 * Author URI: https://herve.bzh
 * License: GPL2+
 */
function jeherve_capital_title_og( $tags ) {
	global $post;

	if ( is_singular() && $post ) {
		unset( $tags['og:title'] );

		$tags['og:title'] = strtoupper( get_the_title( $post->ID ) );
	}
	return $tags;
}
add_filter( 'jetpack_open_graph_tags', 'jeherve_capital_title_og' );

To be pasted in your theme’s functions.php file, or in a functionality plugin.

Reactions on the Fediverse and on the ATmosphere

Continuez votre lecture / Keep reading

Discover more posts about , or look at some of the posts suggested below.

Jeremy Herve
Jeremy Herve

WordPress, TV Series, music, kids, and board games. I think that’s probably the best way to define me in a few words. 🙂

I work at Automattic where I lead a team building tools for bloggers and creators. I talk a lot about WordPress things, but also about all things open source in general.

I post in English and in French.

I live in Brittany, France, so you’ll also find me sharing pictures from our beautiful region from time to time.

1,241 posts
194 followers