Skip to content

Instantly share code, notes, and snippets.

@ChrisHardie
Created September 24, 2018 16:19
Show Gist options
  • Save ChrisHardie/dbac982a368ebc30b6d449b8732df4f7 to your computer and use it in GitHub Desktop.
Save ChrisHardie/dbac982a368ebc30b6d449b8732df4f7 to your computer and use it in GitHub Desktop.
WordPress one-time role/capability fix for Yoast SEO on Multisite
if ( ! function_exists( 'my_add_seo_caps' ) ) {
function dnc_add_seo_caps() {
// Get admin role
$role = get_role( 'administrator' );
// Add YOAST SEO Roles
$role->add_cap( 'wpseo_manage_options' );
$role->add_cap( 'wpseo_edit_advanced_metadata' );
$role->add_cap( 'wpseo_manage_redirects' );
$role->add_cap( 'wpseo_bulk_edit' );
}
add_action( 'init', 'my_add_seo_caps' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment