gregrickaby / nextjs-wordpress

💀 It's headless WordPress!

Home Page:https://nextjswp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: nextjs-wordpress-{plugin,theme} not active on initial bootstrapping

montchr opened this issue · comments

All other plugins are activated, but nextjs-wordpress-plugin is not, and twentytwentythree is the active theme.

From initial composer output during install:

  - Installing nextjswp/nextjs-wordpress-plugin (dev-main): Symlinking from ../../../packages/nextjs-wordpress-plugin
  - Installing nextjswp/nextjs-wordpress-theme (dev-main): Symlinking from ../../../packages/nextjs-wordpress-theme

I think I read somewhere that WordPress doesn't like symlinks? But that's just an inkling.

Even though twentytwentythree is listed as activated, in the admin UI I get the following banner alert:

Error: The theme directory "twentytwentythree" does not exist.

I first noticed the issue when I published a post and saw that its URL pointed to https://nextjswp.test/2023/02/10/just-a-post-press/, which should not be the case (I think?). Upon visiting that URL, I see the WPSoD displaying the same message about the missing theme.

I noticed that I hadn’t destroyed the previous Docker volumes after seeing a bunch of duplicate posts. However, destroying and recreating everything still resulted in the same issue of the plugin and theme not activating.

Related issue that makes it a bit harder to debug is that the setup script doesn’t show output. But I added a set -e flag to the script and found that after doing so none of the plugins were activated, so I’m guessing theres an error happening during the process – in its present state, the script continues despite the error.

Looks like the menus weren't assigned to their respective locations either. In the wp-cli container after initial setup:

/var/www/html $ wp menu location assign header header-menu
Error: Invalid location header-menu.
/var/www/html $ wp --info^C
/var/www/html $ wp menu location assign footer footer-menu
Error: Invalid location footer-menu.
/var/www/html $ wp menu location list
+----------+-------------+
| location | description |
+----------+-------------+
+----------+-------------+

Even though there's no listed menu locations, I do see them available in the admin UI. Even after assigning them in the UI, however, the menu locations still aren't populating the wp-cli list.

@montchr I see what's happening. The nextjs-wordpress-wpcli container is spinning up and running the install script before nextjs-wordpress-wordpress container has a chance to finish. I'm on it!

EDIT: It's a symlink issue. WP CLI cannot see the plugin and theme (even though they are there via symlink) so it can neither activate the theme nor the menus. 🙃