Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Last active April 13, 2021 17:58
Show Gist options
  • Save strangerstudios/c188f7383410ee57374c to your computer and use it in GitHub Desktop.
Save strangerstudios/c188f7383410ee57374c to your computer and use it in GitHub Desktop.
Filter the Membership Checkout meta description using Yoast SEO.
<?php
//Update line 6 below to your preferred dynamic page description.
function my_pmpro_filter_wpseo_metadesc($description) {
global $pmpro_pages, $pmpro_level;
if( is_page($pmpro_pages['checkout']) ) {
$description = $pmpro_level->description;
}
return $description;
}
add_filter('wpseo_metadesc', 'my_pmpro_filter_wpseo_metadesc');
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Dynamically Filter Membership Checkout Page Title and Meta Description Using Yoast SEO" at Paid Memberships Pro here: https://www.paidmembershipspro.com/dynamically-filter-membership-checkout-page-wp_title-meta-description-using-yoast-seo/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment