johngodley / redirection

Manage all your WordPress 301 redirects and monitor 404 errors
https://redirection.me
GNU General Public License v3.0
553 stars 138 forks source link

class Red_Group not found when doing Red_Item::create #3910

Closed traed closed 1 month ago

traed commented 1 month ago

When trying to use the PHP API to do Red_Item::create I get the error Error: Class "Red_Group" not found. The class Red_Item works though which leads me to believe Red_Item is always required but Red_Group is only required in some parts of the plugin but not others, even though Red_Item has depends on it.

I guess the easy solution would be to require_once group.php from, in this case, Red_Item_Sanitize (since that is where it is used).

johngodley commented 1 month ago

It's not an API, but you can follow the issue here: #3787

traed commented 1 month ago

Says API right here: https://redirection.me/developer/php-api/

johngodley commented 1 month ago

It also says 'It should be noted that this API is subject to change. Use at your own risk.'

johngodley commented 1 month ago

Says API right here

But yeah, point taken. What I was trying to say is that it's not an official API that you can rely on to do things. It may change, and in this instance some functions are only loaded if you follow a certain route through the code - it wasn't designed as an 'API'.