Skip to content

Instantly share code, notes, and snippets.

@bhwebworks
Last active November 13, 2015 14:14
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 bhwebworks/9d3a8d110dcb96638234 to your computer and use it in GitHub Desktop.
Save bhwebworks/9d3a8d110dcb96638234 to your computer and use it in GitHub Desktop.
// Execute late to catch 'clone' and 'new draft' (Duplicate Post plugin)
add_filter( 'post_row_actions', 'bhww_core_remove_quick_edit_options', 100, 2 );
add_filter( 'page_row_actions', 'bhww_core_remove_quick_edit_options', 100, 2 );
function bhww_core_remove_quick_edit_options( $actions, $post ) {
if ( current_user_can( 'update_core' ) )
return $actions;
global $post;
$protected_value = get_post_meta( $post->ID, 'protected_value', true );
if ( 'Protected' == $protected_value ) {
unset( $actions['inline hide-if-no-js'], $actions['trash'], $actions['edit'], $actions['clone'], $actions['edit_as_new_draft'] );
return $actions;
} else {
return $actions;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment