pressbooks / pressbooks-aldine

Aldine is the default root theme for Pressbooks.
https://pressbooks.org/
GNU General Public License v3.0
11 stars 7 forks source link

fix: ensure front page can be set if existing front page is deleted #418

Closed greatislander closed 10 months ago

greatislander commented 10 months ago

Resolves #402.

A custom front page can't be set if the site option show_on_front is set to posts. The private function _reset_front_page_settings_for_post is added as an action to the before_delete_post and wp_trash_post hooks; if the page assigned to the page_on_front option is deleted, this function changes the show_on_front option to posts, meaning that a new front page can't be assigned until show_on_front is set to page again. Aldine doesn't use posts, and there's no interface to change what's shown on the front page from a page to posts or vice versa exposed in Aldine (the reading options page is hidden). I resolved the issue by unhooking the _reset_front_page_settings_for_post function. Now, if the selected front page is deleted, the home page will show a 404 until a new one is selected in the customizer.