fix: ensure front page can be set if existing front page is deleted #418
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #402.
A custom front page can't be set if the site option
show_on_front
is set toposts
. The private function_reset_front_page_settings_for_post
is added as an action to thebefore_delete_post
andwp_trash_post
hooks; if the page assigned to thepage_on_front
option is deleted, this function changes theshow_on_front
option toposts
, meaning that a new front page can't be assigned untilshow_on_front
is set topage
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.