[wp-trac] [WordPress Trac] #34058: Proposal: wp_get_archives_object() function

WordPress Trac noreply at wordpress.org
Mon Sep 28 16:10:29 UTC 2015


#34058: Proposal: wp_get_archives_object() function
-----------------------------+-----------------------------
 Reporter:  davetgreen       |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:  4.3.1
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 I'm currently working on building a personal site using the WP REST API,
 and one of the features I want to introduce is an equivalent to the
 archives widget on the front-end.

 Unfortunately, this isn't so straight forward given that I have no quick
 means of accessing an object representing the current archives. The
 existing function `wp_get_archives()` will return lots of lovely HTML -
 which I can use out of the box perfectly well - but this is useless given
 that I want full control of the data to manipulate/parse/sort as well as
 having something that is more suitable for output via JSON in the API.

 I propose that a new function called `wp_get_archives_object()` be added
 to give developers immediate access to the archives object for general use
 without having to get their hands dirty.

 As a compromise, perhaps add an additional parameter to
 `wp_get_archives()` that when set to `true` simply returns the object?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34058>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list