As I’ve been working to update our instances of WordPress to the new theme, I’ve learned a few things. I thought I’d take a minute to document them for myself (and anyone else who cares to read).
Source Code for a Page
WP URL Autocomplete
I also learned that WordPress will autocomplete URLs for you. For example, this post is located at https://pages.charlotte.edu/forsyth/blog/2018/03/09/tips-and-tricks/, but if you only input https://pages.charlotte.edu/forsyth/blog/2018/03/09/tips into the address bar, WordPress will still navigate to this post. In WordPress this is called canonical redirect.
WordPress allows users to automatically add new top-level pages to a WordPress menu. You can select this option by checking the box below your menu.
However, subpages – pages you create with a parent using the page hierarchy – don’t get added automatically. I’m not sure why WordPress has not implemented this as it seems intuitive to me. In fact, if you do not create a menu and your theme allows a fallback, then WordPress will create a menu including subpages, using a function called wp_list_pages. Having a fallback menu complicates things in it’s own way. For example, if you do not want a menu, you have to create a menu with no menu items. Very counter-intuitive. I’ve done a couple of things to try to “fix” this. First, since our theme previously used a fallback, many sites were relying on that fallback. I wrote a script to create menus for those sites, which mirrored the menu they had previously. The new menu, called Page Hierarchy Menu, automatically adds new top-level pages. Then I added a plugin called Auto Submenu to take care of any subpages.