#52753 closed defect (bug) (invalid)
using_index_permalinks() on null
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 5.6 |
| Component: | Site Health | Keywords: | |
| Focuses: | Cc: |
Description
On a plugin, on do_action('plugins_loaded'), this function is activated
<?php public function plugins_loaded() { if ( ! class_exists( 'WP_Site_Health' ) ) require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; self::$_tests = WP_Site_Health::get_tests(); }
this code was working in wp 5.5.3 but fails in wp 5.6
In 5.6 returns Call to a member function using_index_permalinks() on null in wp-includes/rest-api.php:403
this code was working in wp 5.5.3 but fails in 5.6
Regards
Change History (4)
#1
@
5 years ago
- Component changed from General to Site Health
- Severity changed from major to normal
#3
@
4 years ago
- Keywords reporter-feedback removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
Since we've not head anything here in a while, I'm closing the ticket as invalid based on my previous comment about load-timing, but the ticket can still be responded to, and information still be provided if there are other scenarios that should be considered, or there is something we might have missed here.
#4
@
3 years ago
We just recently ran into the same issue with the ActivityPub plugin: https://github.com/Automattic/wordpress-activitypub/issues/375
But as @Clorith said, it is a problem from the load order, changing from plugins_loaded to init solves the issue.
Hiya,
This appears related to the change in asynchronous tests being moved to the REST API, and the calls to
rest_urlin the test generator function you are calling.The
rest_urlfunction relies on the$wp_rewriteglobal class when pretty permalinks are enabled, which isn't available as early as theplugins_loadedaction, but should instead be used with either theinitorwphook.