MediaRon / post-type-archive-mapping

Map your post type archives with a page/page template
GNU General Public License v2.0
19 stars 13 forks source link

Notice: register_rest_route was called incorrectly in WordPress 5.5 #83

Open peterhebert opened 4 years ago

peterhebert commented 4 years ago

When I activate the plugin in WordPress 5.5, I get the following errors:

Notice: register_rest_route was called incorrectly. The REST API route definition for ptam/v2/get_terms is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in /app/web/wp/wp-includes/functions.php on line 5225 Call Stack: 0.0002 419896 1. {main}() /app/web/wp/wp-admin/post-new.php:0 0.2092 9282104 2. require('/app/web/wp/wp-admin/edit-form-blocks.php') /app/web/wp/wp-admin/post-new.php:72 0.2092 9283352 3. array_reduce() /app/web/wp/wp-admin/edit-form-blocks.php:77 0.2092 9283352 4. rest_preload_api_request() /app/web/wp/wp-admin/edit-form-blocks.php:77 0.2092 9283952 5. rest_do_request() /app/web/wp/wp-includes/rest-api.php:1983 0.2092 9283952 6. rest_get_server() /app/web/wp/wp-includes/rest-api.php:463 0.2093 9285216 7. do_action() /app/web/wp/wp-includes/rest-api.php:505 0.2093 9285592 8. WP_Hook->do_action() /app/web/wp/wp-includes/plugin.php:478 0.2093 9285592 9. WP_Hook->apply_filters() /app/web/wp/wp-includes/class-wp-hook.php:311 0.2193 9695336 10. PTAM\Includes\Rest\Rest->register_routes() /app/web/wp/wp-includes/class-wp-hook.php:287 0.2193 9696088 11. register_rest_route() /app/web/app/plugins/post-type-archive-mapping/includes/rest/class-rest.php:32 0.2193 9697400 12. _doing_it_wrong() /app/web/wp/wp-includes/rest-api.php:102 0.2193 9698168 13. trigger_error() /app/web/wp/wp-includes/functions.php:5225 Notice: register_rest_route was called incorrectly. The REST API route definition for ptam/v2/get_posts is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in /app/web/wp/wp-includes/functions.php on line 5225 Call Stack: 0.0002 419896 1. {main}() /app/web/wp/wp-admin/post-new.php:0 0.2092 9282104 2. require('/app/web/wp/wp-admin/edit-form-blocks.php') /app/web/wp/wp-admin/post-new.php:72 0.2092 9283352 3. array_reduce() /app/web/wp/wp-admin/edit-form-blocks.php:77 0.2092 9283352 4. rest_preload_api_request() /app/web/wp/wp-admin/edit-form-blocks.php:77 0.2092 9283952 5. rest_do_request() /app/web/wp/wp-includes/rest-api.php:1983 0.2092 9283952 6. rest_get_server() /app/web/wp/wp-includes/rest-api.php:463 0.2093 9285216 7. do_action() /app/web/wp/wp-includes/rest-api.php:505 0.2093 9285592 8. WP_Hook->do_action() /app/web/wp/wp-includes/plugin.php:478 0.2093 9285592 9. WP_Hook->apply_filters() /app/web/wp/wp-includes/class-wp-hook.php:311 0.2193 9695336 10. PTAM\Includes\Rest\Rest->register_routes() /app/web/wp/wp-includes/class-wp-hook.php:287 0.2196 9699960 11. register_rest_route() /app/web/app/plugins/post-type-archive-mapping/includes/rest/class-rest.php:40 0.2196 9701272 12. _doing_it_wrong() /app/web/wp/wp-includes/rest-api.php:102 0.2196 9702040 13. trigger_error() /app/web/wp/wp-includes/functions.php:5225

Looks like there have been changes to the WordPress REST API in 5.5.

This thread in support suggests adding 'permission_callback' => '__return_true', to $args array solves issue.

peterhebert commented 4 years ago

I submitted this pull request to address the issue: #84

ronalfy commented 4 years ago

Thank you. I’ll try to take a look tonight. I have random stuff in the “to be released” branch that needs testing. Rest routes should be fine. I’m not sure about the rest yet. Hope that makes sense. Thanks.

Ronald

On Fri, Aug 21, 2020 at 15:29 Peter Hebert notifications@github.com wrote:

I submitted this pull request to address the issue: #84 https://github.com/MediaRon/post-type-archive-mapping/pull/84

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MediaRon/post-type-archive-mapping/issues/83#issuecomment-678479124, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE3M2PK4RYTBKXP2LCZWNDSB3KJNANCNFSM4QHTSPKQ .

-- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error, please notify Ronald Huereca at ronalfy@gmail.com.

You can only delay the inevitable. www.ronalfy.com