Skip to content

Instantly share code, notes, and snippets.

@rmpel
Last active December 20, 2018 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmpel/195e6a50529f948241bab65b1709faf7 to your computer and use it in GitHub Desktop.
Save rmpel/195e6a50529f948241bab65b1709faf7 to your computer and use it in GitHub Desktop.
Cleanup clutter in WordPress 5.x post/page tables

Transform

Before

into

After

<?php
add_filter('display_post_states', function($states){
$translate = array(
'/SiteOrigin Page Builder/' => '<span class="dashicons dashicons-editor-table" title="SiteOrigin Page Builder"> </span>',
'/Block Editor/' => '<span class="dashicons dashicons-grid-view" title="Gutenberg Editor"> </span>',
'/Classic Editor/' => '<span class="dashicons dashicons-edit" title="Classic Editor"> </span>',
);
foreach ($states as $key => &$state) {
foreach ($translate as $pattern => $new_value) {
if (preg_match($pattern, $state)) {
$state = $new_value;
}
}
}
return $states;
}, PHP_INT_MAX);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment