# Permalinks of table of contents

**URL:** <https://pressbooks.community/t/permalinks-of-table-of-contents/585>\
**Category:** Developer Questions\
**Created:** [June 27, 2018, 7:47am UTC](https://pressbooks.community/t/permalinks-of-table-of-contents/585 "2018-06-27T07:47:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![danzhik](https://pressbooks.community/letter_avatar_proxy/v4/letter/d/47e85d/32.png) [@danzhik](https://pressbooks.community/u/danzhik)\
**Post date:** [June 27, 2018, 7:47am UTC](https://pressbooks.community/t/permalinks-of-table-of-contents/585/1 "2018-06-27T07:47:38Z")

</div>

Hello!  
When I am changing name of the book in book editing section, ‘Book Address (URL)’ field (/wp-admin/network/site-info.php?id=2 link), the permalinks in tables of contents in front-end of web-site remain with the old name of a book, which leads to non-existing web-page of book parts (chapters etc.) after changing name of book. The problem appears in a installation of latests versions of WP and PB, here is the diagnostics output of website:  
\<\<\<

### System Information

#### Root Blog Info

Root Blog ID: 1  
Root Blog URL: [http://localhost/wordpressmulti/](http://localhost/wordpressmulti/)

#### Browser

Platform: Windows  
Browser Name: Chrome  
Browser Version: 67.0.3396.99  
User Agent String: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

#### WordPress Configuration

Network URL: [http://localhost/wordpressmulti/](http://localhost/wordpressmulti/)  
Network Type: Subdirectory  
Version: 4.9.6  
Language: en\_US  
WP\_ENV: Not set  
WP\_DEBUG: Enabled  
Memory Limit: 64M

#### Pressbooks Configuration

Version: 5.3.4  
Root Theme: Aldine  
Root Theme Version: 1.3.0

#### Pressbooks Dependencies

Epubcheck: Not Installed  
Kindlegen: Not Installed  
xmllint: Not Installed  
PrinceXML: Not Installed  
Saxon-HE: Not Installed

#### Must-Use Plugins

hm-autoloader.php: n/a

#### Network Active Plugins

Pressbooks: 5.3.4

#### Root Blog Active Plugins

#### Inactive Plugins

Add featured image from URL to PressBooks CPTs: 0.1  
Akismet Anti-Spam: 4.0.3  
All In One Metadata: 0.18  
Debug Bar: 0.9  
Debug Bar Console: 0.3  
Hello Dolly: 1.7  
My Language Skills Ads: 0.1

#### Server Configuration

PHP Version: 7.2.2  
MySQL Version: 5.5.5  
Webserver Info: Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.2

#### PHP Configuration

Safe Mode: Disabled  
Memory Limit: 256M  
Upload Max Size: 2M  
Post Max Size: 8M  
Upload Max Filesize: 2M  
Time Limit: 30  
Max Input Vars: 1000  
URL-aware fopen: On (1)  
Display Errors: On (1)

#### PHP Extensions

OPcache: Disabled  
XDebug: Enabled  
cURL: Supported  
cURL Version: 7.57.0  
imagick: Not Installed  
xsl: Not Installed

> > >

I have checked this situtation with some plugins activated and with all the plugins deactivated(except PB main plugin), the output remains the same.

The problem fixes when I do any update of book parts, even just updating chapter without actually changing anything, so just clicking ‘Save’ button in editor. After that all the links in table of context lead to new name of book.

Could you tell me please, if there is something wrong with my configuration and if it is the reason of this bug?  
Thank you a lot in advance.

---

<div class="post-metadata">

**Author:** ![dac.chartrand](https://pressbooks.community/user_avatar/pressbooks.community/dac.chartrand/32/152_2.png) [@dac.chartrand](https://pressbooks.community/u/dac.chartrand)\
**Post date:** [June 27, 2018, 12:57pm UTC](https://pressbooks.community/t/permalinks-of-table-of-contents/585/2 "2018-06-27T12:57:32Z")

</div>

For performance reasons, the Table of contents of a web book are cached in a [transient](https://codex.wordpress.org/Transients_API).

When you save Book Address (URL) Pressbooks doesn’t delete the cache because we are not watching this.

When you do any update of book parts, we are watching this and bust the cache.

I guess this counts a bug.

---

<div class="post-metadata">

**Author:** ![dac.chartrand](https://pressbooks.community/user_avatar/pressbooks.community/dac.chartrand/32/152_2.png) [@dac.chartrand](https://pressbooks.community/u/dac.chartrand)\
**Post date:** [June 27, 2018, 1:01pm UTC](https://pressbooks.community/t/permalinks-of-table-of-contents/585/3 "2018-06-27T13:01:21Z")

</div>

Code is here:

> <https://github.com/pressbooks/pressbooks-book/blob/87279eb0c5e9e3dd184c8f4a58f437bf8ddcfb4a/inc/actions/namespace.php#L15>

Here:

> <https://github.com/pressbooks/pressbooks-book/blob/e2519ad125a01dd97f2f850fed95370a9a29ec8c/functions.php#L52>

And here:

> <https://github.com/pressbooks/pressbooks/blob/4aa337e865beb0502a8eb3915cc8c7eeacd06d4f/inc/class-book.php#L498>

We would need to add a hook on the options.php page

---

<div class="post-metadata">

**Author:** ![dac.chartrand](https://pressbooks.community/user_avatar/pressbooks.community/dac.chartrand/32/152_2.png) [@dac.chartrand](https://pressbooks.community/u/dac.chartrand)\
**Post date:** [June 27, 2018, 1:10pm UTC](https://pressbooks.community/t/permalinks-of-table-of-contents/585/4 "2018-06-27T13:10:09Z")

</div>

If you use WP-CLI you can delete transients like this:

`wp transient delete --all --url=https://yoursitename`

More info: [https://developer.wordpress.org/cli/commands/transient/delete/](https://developer.wordpress.org/cli/commands/transient/delete/)

---

<div class="post-metadata">

**Author:** ![danzhik](https://pressbooks.community/letter_avatar_proxy/v4/letter/d/47e85d/32.png) [@danzhik](https://pressbooks.community/u/danzhik)\
**Post date:** [July 19, 2018, 9:57am UTC](https://pressbooks.community/t/permalinks-of-table-of-contents/585/5 "2018-07-19T09:57:57Z")

</div>

Thank You a lot! I got it!
