Make WordPress Core

Opened 10 years ago

Closed 8 years ago

#24613 closed defect (bug) (worksforme)

get_uploaded_header_images returns empty

Reported by: mhzmaster's profile mhzmaster Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.1
Component: Customize Keywords:
Focuses: Cc:


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()


	$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.


Change History (2)

#1 @SergeyBiryukov
10 years ago

  • Component changed from General to Appearance
  • Keywords reporter-feedback added; needs-patch removed

the 'orderby' => 'none' parameter is not a valid argument and causes the query to fail.

Could not reproduce on a clean install.

'none' is a valid value for orderby parameter: tags/3.5.1/wp-includes/query.php#L2339. It's also documented in Codex.

#2 @chriscct7
8 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Closing per lack of reporter feedback or ability to reproduce the bug

Note: See TracTickets for help on using tickets.