Skip to content

@mgburns /bu-versions-wp-seo.php
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Adds support for post excerpt and WordPress SEO meta fields to alternate versions
<?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.