Opened 11 years ago
Closed 10 years ago
#2761 closed enhancement (worksforme)
similar function to WP's url_to_postid() ?
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | API - Rewrite Rules | Keywords: | |
| Cc: |
Description
We need a function that acts like WP's url_to_postid http://codex.wordpress.org/Function_Reference/url_to_postid, or, even better, make that function compatible with bbPress.
So we could retrieve a forum/subforum/topic/reply ID given its url.
Change History (3)
Note: See
TracTickets for help on using
tickets.
The WordPress function
url_to_postid()works for me with a default pretty permalinks:A forum, sub forum, topic and reply with correct post ID returned below:
var_dump ( url_to_postid('http://import.wp.local/forums/forum/vbulletin-4-content-category/') ); var_dump ( url_to_postid('http://import.wp.local/forums/forum/vbulletin-4-content-category/vbulletin-4-closed-forum/') ); var_dump ( url_to_postid('http://import.wp.local/forums/topic/vbulletin-4-standard-topic/') ); var_dump ( url_to_postid('http://import.wp.local/forums/reply/323/') ); int 272 int 274 int 288 int 323