Processing WordPress Links

WordPress offers a feature to provide pretty links for your posts.

This would be something like

http://206.189.161.181/2014/09/integrating-laravels-auth-with-sentinel/ or even http://206.189.161.181/integrating-laravels-auth-with-sentinel/ or http://206.189.161.181/jacob/integrating-laravels-auth-with-sentinel/ depending on the scheme you choose in your permalink settings.

You may need to process this link to get the actual post id. Say if you are.

 

  1. Building an API
  2. Redirecting traffic
  3. Using XMLRPC http://codex.wordpress.org/XML-RPC_WordPress_API
  4. Writing out an entirely new interface for wordpress.

Good news is that if you have access to the database on which the wordpress installation runs from, this is relatively trivial.

The only part you need to parse is the post name in our case integrating-laravels-auth-with-sentinel  Do a lookup on the wp_posts table post_name column and presto you are done.

A possible implementation of the above steps in Laravel 4.2 would be

The Model to retreive the id

The Interface on which you will code your link parsing algorithm

A simple url parser

 

 

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Published by

jchencha

API Engineer