> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chipmunktheme.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove resource prefix

> A guide on how to remove `/resource/` prefix from the Resource slugs in Chipmunk.

Paste this code into the Child Theme’s functions.php file (you can find the base for it [here](https://chipmunktheme.com/child-theme)). Make sure you activate the child theme instead of the main Chipmunk package.

```php functions.php theme={null}
function chipmunk_remove_slug($post_link, $post, $leavename)
{
  if ("resource" != $post->post_type || "publish" != $post->post_status) {
    return $post_link;
  }

  $post_link = str_replace("/" . $post->post_type . "/", "/", $post_link);

  return $post_link;
}
add_filter("post_type_link", "chipmunk_remove_slug", 10, 3);

function chipmunk_parse_request($query)
{
  if (!$query->is_main_query() || 2 != count($query->query) || !isset($query->query["page"])) {
    return;
  }

  if (!empty($query->query["name"])) {
    $query->set("post_type", ["post", "resource", "page"]);
  }
}
add_action("pre_get_posts", "chipmunk_parse_request");
```

<Warning>
  Please remember to refresh the WordPress permalinks after that! Go to **Settings > Permalinks** and click `Save Changes`.
</Warning>
