1 path.inc path_load($conditions)

Fetches a specific URL alias from the database.


$conditions: A string representing the source, a number representing the pid, or an array of query conditions.

Return value

FALSE if no alias was found or an associative array containing the: following keys:

  • source: The internal system path.
  • alias: The URL alias.
  • pid: Unique URL alias identifier.
  • langcode: The language code of the alias.
  • auto: Boolean indicating if this alias was created from a pattern.


core/includes/path.inc, line 360
Functions to handle paths in Backdrop, including URL aliasing.


function path_load($conditions) {
  if (is_numeric($conditions)) {
    $conditions = array('pid' => $conditions);
  elseif (is_string($conditions)) {
    $conditions = array('source' => $conditions);
  elseif (!is_array($conditions)) {
    return FALSE;
  $select = db_select('url_alias');
  foreach ($conditions as $field => $value) {
    $select->condition($field, $value);
  $path = $select
    ->orderBy('pid', 'DESC')
  // Cast the auto column to boolean or NULL if unknown.
  if ($path) {
    $path['auto'] = is_null($path['auto']) ? NULL : (bool) $path['auto'];
  return $path;