CdnXxRRODxX CdnXxRRODxX - 18 days ago 7
Javascript Question

Get Wordpress PostID with Javascript

I'm making a Cordova app and I need to get a wordpress website's postIDs. I've done some research and found that I should use the built-in url_to_postid function. However, since this is a cordova app I am unable to run PHP.

Is there a way to get a postID via Javascript? I have the article URLs from the website's RSS feed, so I can grab them if they are of any help.

I was thinking of using the URL and requesting the postID from the page, however, I'm not sure how to do that, if it's even possible.

Answer

If you're looking to interact with a WP instance from a cordova app, then perhaps you should look into connecting to the WP instance via the REST API to get those kind of details.

See: http://v2.wp-api.org/

Hope this helps :)

Comments