Skip to content

Instantly share code, notes, and snippets.

@styledev
Created September 28, 2013 22:13
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 styledev/72ddfae8881dc5e3224a to your computer and use it in GitHub Desktop.
Save styledev/72ddfae8881dc5e3224a to your computer and use it in GitHub Desktop.
Fixes the Notice: Trying to get property of non-object in plugins/edit-flow/modules/editorial-metadata/editorial-metadata.php on line 634
function filter_manage_posts_columns( $posts_columns ) {
$screen = get_current_screen();
if ( $screen ) {
add_filter( "manage_{$screen->id}_sortable_columns", array( $this, 'filter_manage_posts_sortable_columns' ) );
$terms = $this->get_editorial_metadata_terms( array( 'viewable' => true ) );
foreach( $terms as $term ) {
// Prefixing slug with module slug because it isn't stored prefixed and we want to avoid collisions
$key = $this->module->slug . '-' . $term->slug;
$posts_columns[$key] = $term->name;
}
}
return $posts_columns;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment