Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Adds support for post excerpt and WordPress SEO meta fields to alternate versions

View bu-versions-wp-seo.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
<?php
/*
Plugin Name: BU Versions - WordPress SEO Support
Description: Adds support for post excerpt and WordPress SEO meta fields to alternate versions
*/
/**
* Required as the WordPress SEO plugin doesn't use post type support, and BU Versions requires it.
*/
function wpseo_feature_support() {
add_post_type_support( 'page', 'wpseo' );
add_post_type_support( 'post', 'wpseo' );
}
/**
* Register WordPress SEO meta keys for alternate versions.
*/
function wpseo_alt_version_features( $features ) {
$features['wpseo'] = array(
'_yoast_wpseo_snippetpreview',
'_yoast_wpseo_focuskw',
'_yoast_wpseo_title',
'_yoast_wpseo_metadesc',
'_yoast_wpseo_metakeywords'
);
return $features;
}
/**
* Add "excerpts" to the alternate version post type registration arguments.
*/
function wpseo_alt_version_args( $args, $post_type ) {
if ( post_type_supports( $post_type->name, 'excerpt' ) ) {
$args['supports'] = array_unique( array_merge( $args['supports'], array( 'excerpt' ) ) );
}
return $args;
}
add_action( 'init', 'wpseo_feature_support' );
add_filter( 'bu_alt_versions_feature_support', 'wpseo_alt_version_features' );
add_filter( 'bu_alt_version_args', 'wpseo_alt_version_args', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.