Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Publicious.org
Plugins
Media Categories
Commits
6c19f5ec
Commit
6c19f5ec
authored
Sep 28, 2016
by
John James Jacoby
Browse files
Only filter main queries, and suppress filters to avoid stomping JOIN's.
parent
90ec7300
Changes
1
Hide whitespace changes
Inline
Side-by-side
wp-media-categories/includes/functions.php
View file @
6c19f5ec
...
...
@@ -73,7 +73,7 @@ function wp_media_categories_get_media_category_options( $selected_value = '' )
function
wp_media_categories_no_category_request
(
$query_args
=
array
()
)
{
// Bail if not in admin
if
(
!
is_admin
()
)
{
if
(
!
is_admin
()
||
!
is_main_query
()
)
{
return
$query_args
;
}
...
...
@@ -85,6 +85,12 @@ function wp_media_categories_no_category_request( $query_args = array() ) {
// No categories, so do a "NOT EXISTS" taxonomy query
if
(
'no_category'
===
$query_args
[
$media_category
]
)
{
// This is necessary to prevent the JOIN clause from being stomped
// and replaced for postmeta
$query_args
[
'suppress_filters'
]
=
true
;
// This adds a taxonomy query, looking for no terms
$query_args
[
'tax_query'
]
=
array
(
array
(
'taxonomy'
=>
$media_category
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment