Skip to:
Content

Opened 4 years ago

Closed 3 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:
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)

#1 @netweb
4 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
4 years ago

  • Keywords reporter-feedback added

#3 @thebrandonallen
3 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.