Skip to content

Commit

Permalink
Review improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
NoelLH committed Jul 14, 2021
1 parent 8477cda commit 809a7ac
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/OowpQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ function __construct($query = '')
// 'attachment' which can cause crashes on ?preview=true if a file title matches a render-able post's.
if (!isset($query['post_type']) || (!is_array($query['post_type']) && !array_key_exists($query['post_type'],
$wp_post_types))) {
$query['post_type'] = array_values(get_post_types());
$attachmentTypeIndex = array_search('attachment', $query['post_type'], true);
if ($attachmentTypeIndex !== false) {
array_splice($query['post_type'], $attachmentTypeIndex, 1);
}
$query['post_type'] = array_values(array_diff(get_post_types(), array('attachment')));
}

parent::__construct($query);
Expand Down

0 comments on commit 809a7ac

Please sign in to comment.