[wp-trac] [WordPress Trac] #44387: Add support for site meta in `register_meta()`

WordPress Trac noreply at wordpress.org
Tue Jun 26 21:19:39 UTC 2018


#44387: Add support for site meta in `register_meta()`
--------------------------------+------------------------
 Reporter:  flixos90            |       Owner:  (none)
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  5.0
Component:  Options, Meta APIs  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:  2nd-opinion         |     Focuses:  multisite
--------------------------------+------------------------

Comment (by spacedmonkey):

 So I have looked into this and it is not possible to use the key of site
 over blog. The reason for this are two fold.

 A patch like this could be implemented

 {{{#!php
                 case 'blog':
                 case 'site':
                         $site = get_site( $object_id );
                         if ( ! $site ) {
                                 break;
                         }

                         $object_subtype = 'site';
                         break;
                 case 'site':
                 case 'network':
                         $network = get_network( $object_id );
                         if ( ! $network ) {
                                 break;
                         }

                         $object_subtype = 'network';
                         break;
 }}}

 This function is `get_object_subtype` is not a developer focused. It is
 designed for internal use so passing blog to it is logical, as the naming
 within core is blog. Core uses the naming blog and all referencecs in the
 *_site_meta functions. It is impossible to have one meta type for
 developers and another for core. Also, as you can see, the key of site is
 already used for networks.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44387#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list