#40948 closed enhancement (fixed)
Load meta files earlier in `wp-settings.php`
Reported by: | flixos90 | Owned by: | flixos90 |
---|---|---|---|
Milestone: | 5.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bootstrap/Load | Keywords: | ms-roadmap |
Focuses: | multisite | Cc: |
Description
We're currently working on bringing meta functionality to sites and networks. While this is still in the early stages of discussion, we're sure that we would at least like to enable plugins to introduce this functionality (DB table and API), even if we come to the conclusion that site and network meta are not eligible for core itself (see #37923 and #25344 for background discussion on site and network meta).
A general problem is that the meta functionality is not available when bootstrapping multisite and when using classes like WP_Site_Query
and WP_Network_Query
(which need to support meta_query
). Therefore the meta files should be loaded earlier, in particular:
wp-includes/meta.php
wp-includes/class-wp-meta-query.php
wp-includes/class-wp-metadata-lazyloader.php
They should be loaded together with the other "early" WordPress files. This does not only make sense for the above specific use-case, but also because the meta API is a generally reusable basic database interaction API and allows to work with arbitrary "name-value" pairs, just like options. The Options API is also available early, and the Meta API should follow.
Change History (24)
#2
@
8 years ago
- Summary changed from Load meta files earlier in `ms-settings.php` to Load meta files earlier in `wp-settings.php`
Whoops, typo in the summary.
This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.
7 years ago
#4
@
7 years ago
- Keywords 2nd-opinion removed
- Milestone changed from Awaiting Review to Future Release
This is a requirement for the site meta API we're planning (and also for network meta if we do it).
#5
@
7 years ago
- Keywords ms-roadmap added
These tickets belong to our planned roadmap (a few of them not per final decision), so flagging with a keyword for better overview.
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
7 years ago
#7
@
7 years ago
As noted during the work on #37923, wp-includes/formatting.php
needs to be loaded early as well, since the metadata API requires parts of it.
This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.
7 years ago
This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.
7 years ago
#10
@
7 years ago
I'm not really opposed to getting this in earlier than later. It would be nice to know that not having these available earlier is currently blocking someone's external work.
From a core perspective, we'll be moving formatting.php
and meta.php
up in the boot process in #37923 anyway. The others can be moved as part of #40229 if they aren't already.
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
7 years ago
This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.
7 years ago
#15
@
7 years ago
For #40229 we'll still need to move the class-wp-meta-query.php
to be loaded earlier, as mentioned before.
#17
@
7 years ago
This change seems to have broken the installer -
PHP Fatal error: Cannot redeclare wptexturize() (previously declared in /wp-includes/formatting.php:51) in /wp-includes/formatting.php on line 313
#18
@
7 years ago
- Severity changed from normal to critical
As Barry points out, shuffling load order is really dangerous and brings up edge cases. It shouldn't be done without unit tests...
Should [42835] be reverted until all edge cases are fixed?
Also, formatting.php shouldn't be needed for accessing the db. I'd rather move sanitize_key()
or introduce a similar function than load a file that is clearly intended for formatting the PHP output while accessing the db.
#19
@
7 years ago
- Severity changed from critical to normal
Noting that the above is already fixed in [42988]. What other edge cases are there? And how would you find them if things get reverted?
#20
@
7 years ago
@barry Seems that this bug had indeed already been reported via #43609 and fixed in [42988] as @ocean90 stated above. Can you verify that solves the problem on wp.com?
Reverting [42835] is not really an option since other functionality is built on it that requires some of the functions to be loaded early. I'd like to emphasize what was said before, that reverting furthermore wouldn't allow us to find these bugs. If there's anything else, please report on this ticket or as an individual ticket referencing this one, and we'll get it fixed.
Big +1 from me.