Permalink
Browse files

Avoid `pre_get_posts` query filtering when using the new Media Manage…

…r in WP 3.5. Fixes #90.
  • Loading branch information...
1 parent 749cd96 commit 275749d3f790d3aa81ba5f0ce5140ab9536d62eb @johnbillion johnbillion committed Jan 17, 2013
Showing with 20 additions and 0 deletions.
  1. +20 −0 class-post-public.php
View
@@ -575,6 +575,9 @@ public function pre_get_posts( $query ) {
if ( $this->is_media_upload_tab( 'gallery' ) ) {
return;
}
+ if ( $this->is_media_manager() ) {
+ return;
+ }
$query->query_vars = $this->translate_query_vars( $query->query_vars );
}
@@ -1812,6 +1815,23 @@ protected function is_media_upload_tab( $tab = null ) {
}
/**
+ * Are we viewing the (3.5+) media manager?
+ *
+ * @return boolean True if we are viewing the media manager
+ **/
+ protected function is_media_manager() {
+ if ( ! is_admin() )
+ return false;
+ if ( !isset( $_POST['action'] ) ) {
+ return false;
+ }
+ if ( 'query-attachments' == $_POST['action'] ) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Remove over-synced post metas.
*
* @return void

0 comments on commit 275749d

Please sign in to comment.