Skip to content

Instantly share code, notes, and snippets.

@someguy9
Last active January 21, 2023 22:41
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 someguy9/aab28f66b49546db59d1f2e80f64a5f5 to your computer and use it in GitHub Desktop.
Save someguy9/aab28f66b49546db59d1f2e80f64a5f5 to your computer and use it in GitHub Desktop.
Use RankMath title for MightyShare.io renders in WordPress https://mightyshare.io/
<?php
// If RankMath is active & a meta title is set use it with MightyShare instead of post title
function mightyshare_use_rankmath_seo_title( $template_options ) {
if ( in_array( 'seo-by-rank-math/rank-math.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) {
global $post;
$rankmath_title = RankMath\Post::get_meta( 'title', $post->ID );
if(!empty($rankmath_title)){
// Use RankMath title for MightyShare
$template_options['title'] = $rankmath_title;
}
}
return $template_options;
}
add_filter( 'mightyshare_filter_post', 'mightyshare_use_rankmath_seo_title', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment