[wp-trac] [WordPress Trac] #19744: url_to_postid() doesn't reconise Custom post types (was: Custom post type doesn't receive pingback)

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 5 01:22:19 UTC 2012


#19744: url_to_postid() doesn't reconise Custom post types
-----------------------------+--------------------
 Reporter:  feedmeastraycat  |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  3.4
Component:  Query            |     Version:  3.3.1
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |
-----------------------------+--------------------
Changes (by dd32):

 * component:  XML-RPC => Query
 * milestone:  Awaiting Review => 3.4


Old description:

> ''(I hope this isn't a duplicate or a "feature". I've tried to search but
> couldn't find anything.)''
>
> It seams like custom post type doesn't receive pingbacks. The XML-RCP
> server doesn't recognize the URL. The url_to_postid() function in
> rewrite.php finds a match, but the query is all wrong.
>
> Example, if I set up custom post type with no "rewrite" in the arguments.
> The URL to a custom post type would be:
> mydomain.com/custom_post_type_name/post-slug/
>
> The function url_to_postid() finds a match on:
> {{{
> custom_post_type_name/([^/]+)(/[0-9]+)?/?$
> }}}
> The query is:
> {{{
> custom_post_type_name=$matches[1]&page=$matches[2]
> }}}
>
> But the query string (after WP_MatchesMapRegexp::apply()) looks like
> this:
> {{{
> custom_post_type_name=post-slug&page=
> }}}
>
> And the array that is sent into WP_Query looks like this:
> {{{
> Array
> (
>     [tips_and_trix] => finns-sjukt-manga-tips-har
>     [page] =>
> )
> }}}
>
> Which makes url_to_postid() return 0; And XML-RCP server returns
> IXR_Error(33, ...)

New description:

 It seams like custom post type doesn't receive pingbacks. The XML-RPC
 server doesn't recognize the URL. The url_to_postid() function in
 rewrite.php finds a match, but the query is all wrong.

 Example, if I set up custom post type with no "rewrite" in the arguments.
 The URL to a custom post type would be: mydomain.com/custom_post_type_name
 /post-slug/

 The function url_to_postid() finds a match on:
 {{{
 custom_post_type_name/([^/]+)(/[0-9]+)?/?$
 }}}
 The query is:
 {{{
 custom_post_type_name=$matches[1]&page=$matches[2]
 }}}

 But the query string (after WP_MatchesMapRegexp::apply()) looks like this:
 {{{
 custom_post_type_name=post-slug&page=
 }}}

 And the array that is sent into WP_Query looks like this:
 {{{
 Array
 (
     [tips_and_trix] => finns-sjukt-manga-tips-har
     [page] =>
 )
 }}}

 Which makes url_to_postid() return 0; And XML-RCP server returns
 IXR_Error(33, ...)

--

Comment:

 My suggestion is that the logic from
 [http://core.trac.wordpress.org/browser/trunk/wp-includes/class-
 wp.php#L274 WP::parse_request()] that I mentioned above should be moved
 into WP_Query.

 I'm going to let another dev weigh in on that however, as I might be
 missing something related..

 I've altered the fields to match the problem a bit more too.

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


More information about the wp-trac mailing list