cuny-academic-commons / cbox-theme

Default theme for Commons In A Box
GNU General Public License v2.0
20 stars 15 forks source link

page_on_front logic should happen before first front-end pageload #257

Open boonebgorges opened 6 years ago

boonebgorges commented 6 years ago

cbox_theme_auto_create_home_page() fires on wp, which means that page_on_front and the homepage-template page template aren't set until the first front-end pageload. This can result in the first pageload being the WP default, which is confusing for the administrator. It also means that the queries run on every WP pageload, which seems wasteful.

It's not currently possible to swap this out directly with a direct call or a different hook, because of the use of is_404().

Ideally, we'd simply call this function during the installation process, eliminating the need to call it again on subsequent pageloads. If that's not possible, perhaps we can check only on admin pages, or when the super admin is logged in.


Edit by r-a-y - See #120