Skip to content

Conversation

@t-hamano
Copy link
Contributor

When developing locally, the typical setup is a single-site environment, so get_blog_details is not callable. This results in the following error:

Fatal error: Uncaught Error: Call to undefined function WordPressdotorg\MU_Plugins\REST_API\get_blog_details() in /var/www/html/wp-content/mu-plugins/rest-api/index.php:24 Stack trace: #0 /var/www/html/wp-includes/class-wp-hook.php(341): WordPressdotorg\MU_Plugins\REST_API\initialize_rest_endpoints(Object(WP_REST_Server)) #1 /var/www/html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array) #2 /var/www/html/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #3 /var/www/html/wp-includes/rest-api.php(636): do_action('rest_api_init', Object(WP_REST_Server)) #4 /var/www/html/wp-includes/rest-api.php(594): rest_get_server() #5 /var/www/html/wp-includes/rest-api.php(2981): rest_do_request(Object(WP_REST_Request)) #6 [internal function]: rest_preload_api_request(Array, '/wp/v2/types?co...') #7 /var/www/html/wp-includes/block-editor.php(762): array_reduce(Array, 'rest_preload_ap...', Array) #8 /var/www/html/wp-admin/edit-form-blocks.php(114): block_editor_rest_api_preload(Array, Object(WP_Block_Editor_Context)) #9 /var/www/html/wp-admin/post.php(187): require('/var/www/html/w...') #10 {main} thrown in /var/www/html/wp-content/mu-plugins/rest-api/index.php on line 24

I think we should check whether the function exists.

Additionally, I add \ to make it clear that we are calling a global function within a namespace.

@dd32
Copy link
Member

dd32 commented Jan 5, 2026

Additionally, I add \ to make it clear that we are calling a global function within a namespace.

We don't use this coding format on WordPress repo's AFAIK, and obviously global WordPress functions probably don't need to be prefixed as such.

@dd32 dd32 merged commit 8b69d1c into WordPress:trunk Jan 5, 2026
2 checks passed
@t-hamano t-hamano deleted the rest-api-get-blog-details-check branch January 5, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants