Title: [Plugin: Custom Permalinks] PHP Error Undefined variable &#039;path&#039;
Last modified: August 20, 2016

---

# [Plugin: Custom Permalinks] PHP Error Undefined variable 'path'

 *  [jetlej](https://wordpress.org/support/users/jetlej/)
 * (@jetlej)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-custom-permalinks-php-error-undefined-variable-path/)
 * I’m getting roughly 20 of these erros on every page (with debug turned on) :
 * Undefined index: path in /wp-content/plugins/custom-permalinks/custom-permalinks.
   php on line 261
 * This doesn’t affect functionality as far as I can see but I thought I’d report
   it anyways
 * [http://wordpress.org/extend/plugins/custom-permalinks/](http://wordpress.org/extend/plugins/custom-permalinks/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [jonathan.pottervilla](https://wordpress.org/support/users/jonathanpottervilla/)
 * (@jonathanpottervilla)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-custom-permalinks-php-error-undefined-variable-path/#post-2622023)
 * I ran into this issue today. It looks like the issue is with the output of the
   parse_URL path.
 * Here’s the modified code I used to fix the errors:
 * Lines 96 & 97 become:
 *     ```
       $url = parse_url(get_bloginfo('wpurl'), PHP_URL_PATH);
       $request = ltrim(substr($_SERVER['REQUEST_URI'], strlen($url)),'/');
       ```
   
 * Lines 154 & 155:
 *     ```
       $url = parse_url(get_bloginfo('url'), PHP_URL_PATH);
       $request = ltrim(substr($_SERVER['REQUEST_URI'], strlen($url)),'/');
       ```
   
 * Lines 260 & 261:
 *     ```
       $url = parse_url(get_bloginfo('url'), PHP_URL_PATH);
       $request = ltrim(substr($string, strlen($url)),'/');
       ```
   
 * Line 266:
    `return ($string{0} == '/' ? '/' : '') . trailingslashit($url) . $
   _CPRegisteredURL;`
 * The changes are just in syntax, parsing just the path with PHP_URL_PATH rather
   than parsing the whole path, and calling $url[‘path’], which wasn’t getting defined.
 * – Jonathan
 *  [jglovier](https://wordpress.org/support/users/jglovier/)
 * (@jglovier)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-custom-permalinks-php-error-undefined-variable-path/#post-2622032)
 * Just installed the plugin today, also seeing the same issue with these Notices.
 * Thanks for the fix Jonathan. Hoping the plugin gets an update soon.
 *  [Steven](https://wordpress.org/support/users/stgoos/)
 * (@stgoos)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-custom-permalinks-php-error-undefined-variable-path/#post-2622033)
 * Yep, those “undefined index” messages are annoying when debugging is turned on
   BUT I would like to point out that this one needs more urgent attention:
 * > `Notice: has_cap was called with an argument that is deprecated since version
   > 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and
   > capabilities instead.`
 *  [Eric Mann](https://wordpress.org/support/users/ericmann/)
 * (@ericmann)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-custom-permalinks-php-error-undefined-variable-path/#post-2622055)
 * I actually fixed this bug to use the plugin for a client. You can find my “fixed”
   version on GitHub: [https://github.com/ericmann/custom-permalinks/tree/dev](https://github.com/ericmann/custom-permalinks/tree/dev)
 * I’ve also sent the changes back to the original developer via email but have 
   yet to hear back. I’ll pull in the latest release (that fixed a minor compatibility
   issue elsewhere) when I get the chance to the GitHub version is up to date.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: Custom Permalinks] PHP Error Undefined variable 'path'’ is closed
to new replies.

 * ![](https://ps.w.org/custom-permalinks/assets/icon.svg?rev=1785367)
 * [Custom Permalinks](https://wordpress.org/plugins/custom-permalinks/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-permalinks/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-permalinks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-permalinks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-permalinks/reviews/)

 * 4 replies
 * 5 participants
 * Last reply from: [Eric Mann](https://wordpress.org/support/users/ericmann/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-custom-permalinks-php-error-undefined-variable-path/#post-2622055)
 * Status: not resolved