[wp-hackers] Building a JSON API style plugin

Tom Barrett tcbarrett at gmail.com
Mon Nov 28 14:31:29 UTC 2011


Further experimentation shows that this works (functions.php):

<?php
$wp->add_query_var( 'ticket' );
add_rewrite_rule( 'ticket/([0-9]+)/?$', 'index.php?ticket=$matches[1]',
'top' );

add_action( 'template_redirect', 'get_ticket' );
function get_ticket(){
  $ticket = get_query_var( 'ticket' );
  error_log( "ticket={$ticket}" );
  return;
}
?>

Does anyone know which action hook this would be best placed in?


-- 
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett


More information about the wp-hackers mailing list