Find URL alias for a node

Use this snippet to find the URL alias for a node by looking it up in the url_alias table by its node ID.

  1. $src = 'node/'.$node->nid;
  2. $path = db_result(db_query("SELECT dst FROM url_alias WHERE src = '%s'",$src));

Add new comment