Skip to:

Opened 5 years ago

Closed 4 years ago

#2761 closed enhancement (worksforme)

similar function to WP's url_to_postid() ?

Reported by: grosbouff Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: API - Rewrite Rules Keywords:


We need a function that acts like WP's 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)

#1 @netweb
5 years ago

  • Component changed from API to API - Rewrite Rules

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

#2 @netweb
5 years ago

  • Keywords reporter-feedback added

#3 @thebrandonallen
4 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Closing as wontfix per above comment.

Note: See TracTickets for help on using tickets.