[wp-trac] [WordPress Trac] #21623: XML-RPC method wp.getPosts should be able to search

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 20 15:15:25 UTC 2012


#21623: XML-RPC method wp.getPosts should be able to search
------------------------------+------------------------------
 Reporter:  markoheijnen      |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  XML-RPC           |     Version:  3.4
 Severity:  normal            |  Resolution:
 Keywords:  mobile has-patch  |
------------------------------+------------------------------

Comment (by ericmann):

 Replying to [comment:5 markoheijnen]:
 > I don't agree that this is a low-hanging fruit. I think it is a feature
 that people expect.

 I agree this is a feature people expect. I referred to it as "low-hanging
 fruit" in comparison with a complete refactoring of the method to use
 `WP_Query`.  Merely adding the search functionality, as evidenced by a
 very simple patch, is very straight-forward and doesn't require much
 overhead at all.

 It merely maps the `search` element of the `$filter` array to the `s`
 element of the `$query` array.  I expanded "s" to "search" to make the
 method a bit more self-documenting.

 > I also disagree for using WP_Query since wp_get_recent_posts also use
 get_posts but with another default set of arguments. So it isn't something
 we need to implement to gain more functionality.

 Again, I agree.  But since this isn't yet a "blessed task," I leave that
 open to discussion among the rest of the core team.  If we want to
 refactor, I'm not above doing that.  But what do we gain?


 > I think we can simplify the checking and use $filter as our default
 $query and transform number to numberposts if numberposts isn't set.

 Without the search functionality, I would agree.  But "s" is a very
 ambiguous parameter, particularly for 3-rd party client developers.  Being
 able to use different, more explanatory parameter names for xmlrpc
 parameters makes the API easier to program against.  Mapping those
 parameters to what `$query` expects isn't too big of a task.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21623#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list