controller icon indicating copy to clipboard operation
controller copied to clipboard

Can't use "Category" as a Controller

Open codepuncher opened this issue 4 years ago • 0 comments

Creating a Controller called Category to be used on Category archives e.g. /category/category-slug does not work. The errors are:

Notice: Undefined index: __app in /home/lee/Code/wordpress/cleanwp/web/app/themes/sage/vendor/soberwp/controller/src/Controller.php on line 270

Warning: array_merge(): Expected parameter 1 to be an array, null given in /home/lee/Code/wordpress/cleanwp/web/app/themes/sage/vendor/soberwp/controller/src/Controller.php on line 273

Warning: array_merge(): Expected parameter 2 to be an array, null given in /home/lee/Code/wordpress/cleanwp/web/app/themes/sage/vendor/soberwp/controller/src/Controller.php on line 289

Steps to reproduce:

  1. Fresh installation of Bedrock + Sage
  2. Create an empty Controller called Category
  3. Create a Post with a Category called "Data"
  4. View the "Data" category page

This seems to be only related to the name "Data" as "Uncategorized" works fine.

Now, given that the body class is archive category category-data category-2 logged-in admin-bar app-data index-data archive-data category-2-data category-data-data customize-support I assume there is an issue with the repeated data part and how Controller works; we have category, category-data, and category-data-data.

Of course, renaming the category term from "Data" to something else solves the problem, but not in the code.

Any help appreciated. Thanks!

codepuncher avatar Apr 15 '20 11:04 codepuncher