Hi!
Thanks for reaching out, and I’m sorry for the trouble.
I’m sending this to our dev team so they can check, please stand by! π
Kind Regards,
-Roch
Plugin Author
Brian
(@brianmiyaji)
Hey @sagund07 thanks for your feedback! I’m trying to repro this error on our test site. Could you tell me which version of SportsPress you have installed, and if any other plugins are also active? If you could also find out the PHP version that would be good to know as well π
Hey @rochesterj and @brianmiyaji,
thanks for helping out. Currently I am running sportspress in version 2.1.4 + the REST API c
hanges of version 2.1.5 because I used them from github as a hotfix. I did not update sportspress for a while because of the running season and the customizations I made. So updating sportspress maybe interfere the season. I looked through the github commits to find any changes refering to REST API but I did not found any. If you cannot reproduce the error I will upgrade to 2.1.7 and try to get things running. If this does not work I will try to deactivate all the other plugins.
My PHP Version is 5.6 (alternative is 7.0)
I have also encountered this same error upon updating a heavily customized WP install. It seems, actually, that endpoints that set the post_type as anything other than ‘post’ work fine, but if you hit an endpoint where the post_type is set to ‘post’ it throws this error.
**this is also on a Multisite Install
I am using a custom endpoint that looks like this:
?site=subsitename&post_type=post&posts_per_page=10&paged=0&return_args=limit
Updating this issue:
I have found the cause of this error.
If you have a class that extends the WP_REST_Post_Controller for your custom endpoints, you may have redefined the __construct method without calling the parent::__construct, that will replace the construction of the class with your new controller, but the instantiation of the WP_REST_Post_Meta_Fields controller happens within the construct of the parent WP_REST_Post_Controller and is never set.
To fix this problem:
call on the parent::__construct($post_type) from within your custom class’ __construct method
–OR–
do not override the constructor at all.