Opened 12 years ago
Closed 9 years ago
#24613 closed defect (bug) (worksforme)
get_uploaded_header_images returns empty
Reported by: | mhzmaster | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.5.1 |
Component: | Customize | Keywords: | |
Focuses: | Cc: |
Description
Should be a simple fix. I wanted to document a bug I found which causes the built-in Random Header feature to break in WordPress 3.5.1 and trunk.
The call to get_uploaded_header_images() in _get_random_header_data() always returns an empty array, causing get_random_header_image() and get_header_image() to also return null. This results in an empty header image in themes which should support custom headers, including random ones.
I've traced the error to improper arguments to get_post() within the body of get_uploaded_header_images()
wp-includes/theme.php:1003:
$headers = get_posts( array( 'post_type' => 'attachment', 'meta_key' => '_wp_attachment_is_custom_header', 'meta_value' => get_option('stylesheet'), 'orderby' => 'none', 'nopaging' => true ) );
the 'orderby' => 'none' parameter is not a valid argument and causes the query to fail.
with the 'orderby' parameter removed, get_uploaded_header_images() works as intended and header images are shown properly.
I've patched my install of wordpress successfully. A bugfix would be much appreciated.
Thanks!
Could not reproduce on a clean install.
'none'
is a valid value fororderby
parameter: tags/3.5.1/wp-includes/query.php#L2339. It's also documented in Codex.