Created
September 30, 2011 00:14
-
-
Save Viper007Bond/1252312 to your computer and use it in GitHub Desktop.
Private post_status in a List_Table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Your_Media_List_Table extends WP_Media_List_Table { | |
/* some stuff here */ | |
// Adds a WHERE modify filter, calls parent version of prepare_items(), then removes filter | |
function prepare_items() { | |
add_filter( 'posts_where', array( &$this, 'modify_post_status_to_private' ) ); | |
parent::prepare_items(); | |
remove_filter( 'posts_where', array( &$this, 'modify_post_status_to_private' ) ); | |
} | |
// Changes the "post_status" WHERE value from "inherit" to "private" | |
function modify_post_status_to_private( $where ) { | |
return str_replace( "post_status = 'inherit' ", "post_status = 'private' ", $where ); | |
} | |
/* more stuff here */ | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment