Cleaning up behind the WordPress SEO plugin

The WordPress SEO plugin by Joost de Valk, a.k.a Yoast, is undoubtedly a great plugin. But, one thing that bothers me about it is the amount of stuff it adds to the WordPress admin interface. For me that’s not really a problem. I can easily ignore, remove, or hide the features I don’t need, but for people who are beginners or who pay others to handle SEO, the features can be overwhelming. Another issue is that some sites don’t want contributors or authors handling SEO. They give that duty to editors.

Some of this stuff can be turned off by the users, but if you’re handing over a site to beginners they won’t know how to do that and could easily become overwhelmed by all the stuff they’re seeing. Let’s face it, WordPress alone has enough stuff for beginners to deal with. Adding more on top of it only adds to the total cognitive load.

For these reasons, over time I’ve written various plugins that remove certain aspects of the plugin’s output for users who don’t have the responsibilities of an editor. I’ve also found several other people on support forums looking for solutions to this problem, so I’ve decided to put this all together in one plugin and publish it here to help.

Some of the things the WordPress SEO plugin adds to the WordPress admin area:

  1. A link and status indicator in the admin toolbar.
  2. Columns in the post/page listing for SEO Score, SEO Title, Meta Description, and Focus Keywords.
  3. A box for configuring SEO settings on the edit screen on all post types.

Before we dive into the specifics, first a little primer on roles in WordPress. On a standard WordPress installation where no custom roles or capabilities have been implemented, there are five user roles. They are: Subscriber, Contributor, Author, Editor, and Administrator. If it’s a multisite installation, there’s also a Super Admin role. Remember, we’re talking about default roles. If you’ve customized these in any way, the following may not apply to your site.

Subscribers have no write capabilities. They can only read normal public content. Contributors can create posts and edit their own posts, but they cannot publish them. They must submit them for review by an Editor (more on that in a sec). Authors can create posts and edit their own posts, and they can also publish posts. Editors can create, edit, and publish posts. Editors can also edit other peoples’ posts, and generally are the ones responsible for the overall content of a site. Administrators and Super Admins can do all of these things and then some (not relevant to this post).

Because SEO can play such a crucial part in the success of a site, it’s often the duty of an Editor or an Administrator to handle it. Because of this, it’s important to limit, say, an Author’s ability to define and publish the SEO text.

Aside: one could argue that if you don’t trust someone to do the SEO, they shouldn’t be able to publish without Editor approval. Or maybe no one should be able to publish at all without Editor approval. I can agree with this in theory, but in practice things are hardly this ideal. In these cases, it’s best to let people publish their content, let the plugin do it’s standard stuff, and have an Editor come in afterwards and tweak as necessary.

Without further ado, here’s a plugin for cleaning up after the WordPress SEO plugin by Yoast. If you need to customize the roles, check out Roles and Capabilities on the WordPress Codex.

You can view the code below, and you can download it here. The plugin is also on GitHub if you’d like to contribute.

<?php
/*
Plugin Name: WordPress SEO Weight Loss Program
Description: Lose some of the fat that comes from eating Yoast's spam sandwich.
Version: 1.0.0
Author: John Parris
Author URI: https://www.johnparris.com/
License: GPLv2
*/

function jp_wpseo_fat_slicer() {

	// Only do this for users who don't have Editor capabilities
	if ( ! current_user_can( 'edit_others_posts' ) ) {

		add_action( 'add_meta_boxes', 'jp_remove_yoast_metabox', 99 );
		add_filter( 'wp_before_admin_bar_render', 'jp_admin_bar_seo_cleanup' );
		add_filter( 'manage_edit-post_columns', 'jp_remove_columns' );
		add_filter( 'manage_edit-page_columns', 'jp_remove_columns' );
		// add_filter( 'manage_edit-CPTNAME_columns', 'jp_remove_columns' ); // Replace CPTNAME with your custom post type name, for example "restaurants".
	}
}
add_action( 'init', 'jp_wpseo_fat_slicer' );



/**
 * Removes the WordPress SEO meta box from posts and pages
 *
 * @since 1.0.0
 * @uses remove_meta_box()
 */
function jp_remove_yoast_metabox() {

	$post_types = array( 'page', 'post' ); // add any custom post types here

	foreach( $post_types as $post_type ) {
		remove_meta_box( 'wpseo_meta', $post_type, 'normal' );
	}
}



/**
 * Removes the SEO item from the admin bar
 *
 * @since 1.0.0
 * @uses remove_menu
 */
function jp_admin_bar_seo_cleanup() {

	global $wp_admin_bar;
	$wp_admin_bar->remove_menu( 'wpseo-menu' );
}



/**
 * Removes the extra columns on the post/page listing screens.
 *
 * @since 1.0.0
 */
function jp_remove_columns( $columns ) {

	unset( $columns['wpseo-score'] );
	unset( $columns['wpseo-title'] );
	unset( $columns['wpseo-metadesc'] );
	unset( $columns['wpseo-focuskw'] );

	return $columns;
}

3 thoughts on “Cleaning up behind the WordPress SEO plugin

  1. Adio Brand Solutions says:

    Great Plug-in for WordPress. I tried them & it worked best for me with great features. Please post some new plug-ins also with new functionality. Thank you so much. Nice work…

Leave a Reply