[wp-trac] [WordPress Trac] #38626: Audit the default args for load_themes_ajax()
WordPress Trac
noreply at wordpress.org
Wed Nov 2 19:14:44 UTC 2016
#38626: Audit the default args for load_themes_ajax()
--------------------------+-------------------
Reporter: afercia | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.7
Component: Customize | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-------------------
Really not an expert about .org APIs but while testing #38365 noticed
something that didn't look right to me. The default args for
`load_themes_ajax()` introduced in [38813] are:
{{{
// Arguments for all queries.
$args = array(
'per_page' => 100,
'page' => absint( $_POST['page'] ),
'fields' => array(
'slug' => true,
'screenshot' => true,
'description' => true,
'requires' => true,
'rating' => true,
'downloaded' => true,
'downloadLink' => true,
'last_updated' => true,
'homepage' => true,
'num_ratings' => true,
'tags' => true,
),
);
}}}
Was playing with `screenshot` setting it to false but nothing changed, so
a quick check of the fields docs:
https://codex.wordpress.org/WordPress.org_API#List_of_Themes revealed to
me different key names:
{{{
description - false
sections - false
rating - true
ratings - false
downloaded - true
download_link - true
last_updated - true
homepage - true
tags - true
template - true
parent - false
versions - false
screenshot_url - true
active_installs - false
}}}
If i read it correctly, for example `screenshot` should be
`screenshot_url`, in fact when I've changed it and set to false, the
themes had no screenshot, as expected.
Other examples: `downloadLink` should be `download_link`, there's no
`slug` or `requires`, etc. Some of the currently used fields seems the
ones for plugins to me, for example `num_ratings` is used by the plugins
API but there's no such a field in the Themes API doc, unless it's
undocumented.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38626>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list