Skip to content

Instantly share code, notes, and snippets.

@amboutwe
Last active February 1, 2024 16:37
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save amboutwe/18558a7e681e36c6bfe6e4fb647265ce to your computer and use it in GitHub Desktop.
Save amboutwe/18558a7e681e36c6bfe6e4fb647265ce to your computer and use it in GitHub Desktop.
Remove Yoast SEO columns from posts and pages
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Columns
* Credit: Andrew Norcross http://andrewnorcross.com/
* Last Tested: Jun 09 2020 using Yoast SEO 14.3 on WordPress 5.4.1
*
* If you have custom post types, you can add additional lines in this format
* add_filter( 'manage_edit-{$post_type}_columns', 'yoast_seo_admin_remove_columns', 10, 1 );
* replacing {$post_type} with the name of the custom post type.
*/
add_filter( 'manage_edit-post_columns', 'yoast_seo_admin_remove_columns', 10, 1 );
add_filter( 'manage_edit-page_columns', 'yoast_seo_admin_remove_columns', 10, 1 );
function yoast_seo_admin_remove_columns( $columns ) {
unset($columns['wpseo-score']);
unset($columns['wpseo-score-readability']);
unset($columns['wpseo-title']);
unset($columns['wpseo-metadesc']);
unset($columns['wpseo-focuskw']);
unset($columns['wpseo-links']);
unset($columns['wpseo-linked']);
return $columns;
}
@LorenShumaker
Copy link

Where in the theme or wp files do you place this?

@amboutwe
Copy link
Author

amboutwe commented Feb 1, 2018

Typically code snippets are added to your theme's functions.php file.

If you're not familiar with using code snippets, these articles have wonderful advice:
http://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/
http://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/

@billimarie
Copy link

I've been trying to figure this out for the last few days, as simply unchecking the screen option doesn't work.

Thank you for sharing! Solved the issue immediately.

@AakashPat
Copy link

This works as expected! Can you also help with hiding the dropdowns filters that Yoast SEO ads above the table?

@amboutwe
Copy link
Author

@dronainfotech
Copy link

@amboutwe Thanks ...its working nice. Can you tell me how to hide "Cornerstone content" also
Untitled56

@amboutwe
Copy link
Author

@dronainfotech You can disable the cornerstone feature with the steps here: https://yoast.com/help/disable-cornerstone-content/

@dronainfotech
Copy link

@amboutwe Thanks for your reply, It want it to hide in other user's dashboard excluding the Administrator. If I disabled it from the option which you suggested, I think it will disable to "Cornerstone content" from Admin Dashboard Also.

@amboutwe
Copy link
Author

@dronainfotech The cornerstone feature is not filterable by user role. A feature request was recently closed due to the extremely few users requesting the ability to hide cornerstone content by user role.

@dronainfotech
Copy link

dronainfotech commented Jun 26, 2021

@amboutwe The Above is working in case of post and pages but working in case of custom posts. How to hide in custom posts also?
scr

@amboutwe
Copy link
Author

If you have custom post types, you can add additional lines for each post types. Replace {$post_type} with the name of the custom post type.

add_filter( 'manage_edit-{$post_type}_columns', 'yoast_seo_admin_remove_columns', 10, 1 );

@Aimolev
Copy link

Aimolev commented Aug 14, 2021

@amboutwe Hello! I use Yoast Seo and Formidable form plugins. After activation Yoast SEO plugin I've got issue with correct display Formidable views in admin WP (http://domain.com/wp-admin/edit.php?post_type=frm_display). Could you please help, how can I disable all Yost Seo elements from this page?
Thanks.

@amboutwe
Copy link
Author

frm_display would be the post type for the Formidable content so removing the columns would use: manage_edit-frm_display_columns

If you're still having trouble getting it to work, this is not the proper place to request support. Please check out our extensive help section or visit the free support forum. If you require further support, upgrading to our premium version provides you with access to our support team.

@Aimolev
Copy link

Aimolev commented Aug 14, 2021

@amboutwe Thank you for quick answer. I added this code, but issue is keeping
`add_filter( 'manage_edit-frm_display_columns', 'yoast_seo_admin_remove_columns', 10, 1 );
add_filter( 'manage_edit-page_columns', 'yoast_seo_admin_remove_columns', 10, 1 );

function yoast_seo_admin_remove_columns( $columns ) {
unset($columns['wpseo-score']);
unset($columns['wpseo-score-readability']);
unset($columns['wpseo-title']);
unset($columns['wpseo-metadesc']);
unset($columns['wpseo-focuskw']);
unset($columns['wpseo-links']);
unset($columns['wpseo-linked']);
return $columns;
}`
All colums in the page " wp-admin/edit.php?post_type=frm_display" have an offset table structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment