Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#54006 new defect (bug)

Wp Multisite Get, Add, Update and Delete Site Meta Issue.

Reported by: leeml's profile leeml Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.8
Component: Options, Meta APIs Keywords: dev-feedback
Focuses: multisite Cc:


Just working on some code to help with WP Multisite integration...

I have noticed that the add_site_meta function is currently not working.

I had a look through the functions in wp-includes/ms-site.php and found that the first parameter in the 'add_metadata' function called by add_site_meta (line 1012) is 'blog'.

I figured since you changed the blogmeta table to sitemeta that something might be amiss. If the metadata is added thus:

add_metadata( 'site', 1, 'test_site_feta', 'cheese', false );

All appears to work okay, however this does not;

add_metadata( 'blog', 1, 'test_site_feta', 'cheese', false );

Think its a bug...until I had a closer look I had to use MySQL queries to add the site meta.

Change History (3)

#1 @leeml
3 years ago

To be honest 'add_site_meta' is working for the blog meta table, I was looking at an instance where site meta needed to be set via a frontend extension for what is usually a user profile specific action. Hence the need to update the site meta table, in this case anyway.

Which is doable given the use of add_metadata.

It would be useful I guess if the site meta functions could work with the site meta table allowing for then existing site meta functions being renamed to blog meta. i.e. update_blogmeta and so on...

Hence the initial confusion I guess...everything else seems to be table specific i.e. post meta,term meta, user meta and so on.

#2 @SergeyBiryukov
3 years ago

  • Component changed from Database to Options, Meta APIs

#3 @leeml
3 years ago

I found the network option functions in the end, oh boy!

Note: See TracTickets for help on using tickets.