Useful Snippets

Welcome!


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at Unwanted.cloud

RSS Latest posts from my personal blog


Subscribe to RSS feed


Trimming down Yoast SEO in the admin panel – updated 2014 version

Stanislav KhromovStanislav Khromov

Yoast SEO has an obnoxious habit of taking over your admin interface, so it looks something like this:

yoast-seo

Notice how much space Yoast takes up. Unless you are hardcore about your SEO, you really don’t want all that screen estate being wasted.

With just a few lines of code inside your themes functions.php file you can go from that crowded mess to this: yoast-seo-uncluttered

Here’s the snippet you need:

//Remove "page analysis" and annoying SEO columns
add_filter( 'wpseo_use_page_analysis', '__return_false' );

//Make sure the SEO box is at the very bottom of the post edit screen
add_filter( 'wpseo_metabox_prio', 'custom_metabox_prio');
function custom_metabox_prio($in)
{
    return 'low';
};

//Remove SEO menu from Admin bar
add_action( 'wp_before_admin_bar_render', 'custom_admin_bar_render' );
function custom_admin_bar_render()
{
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu('wpseo-menu');
}

//Remove "Has been updated" notification and tour bubble.
add_action( 'get_user_metadata', 'custom_get_user_metadata', 10, 4 );
function custom_get_user_metadata($value, $object_id, $meta_key, $single) {
  if($meta_key === 'wpseo_ignore_tour') {
    return true;
  }

  if($meta_key === 'wpseo_seen_about_version') {
    return defined('WPSEO_VERSION') ? WPSEO_VERSION : null;
  }

  return $value;
}

You can still change the per-page SEO settings, it just won’t clutter your admin.

It is also possible to remove the SEO box from the post edit screen by going up to Screen Options (top right) and uncheck the “WordPress SEO by Yoast” box.

This post was inspired by the following snippet by Jonathan Warren.

Full-stack impostor syndrome sufferer & Software Engineer at Schibsted Media Group

Comments 4
  • Corbin
    Posted on

    Corbin Corbin

    Reply Author

    Another one to add to your arsenal (especially when used in conjunction with ACF), throw this in your functions.php

    apply_filters( 'wpseo_metabox_prio', 'low' );

    You may have noticed your ACF Inputs show up below the SEO box, and if your clients need the most important pieces directly below the content, this fixes that.


    • Stanislav Khromov
      Posted on

      Stanislav Khromov Stanislav Khromov

      Reply Author

      Hey Corbin,

      I think we already do this?
      Check line 5-9. Are there any issues with the current approach?


      • Corbin
        Posted on

        Corbin Corbin

        Reply Author

        Doy! I must have skimmed right by it. Sorry about that! Your method looks like it’ll work just fine. I believe I grabbed my snippet from a WordPress support thread.

        Bookmarked your site for later, you’ve got some handy snippets! Great work!


  • Faye
    Posted on

    Faye Faye

    Reply Author

    Looks like this no longer works with the most recent update to Yoast. Any suggestions?