Uma área de pesquisa sobre o WordPress para devs e autores do tema

add_site_meta ›

add_site_meta ( $site_id, $meta_key, $meta_value, $unique = false )
Parâmetros: (4)
  • (int) $site_id Site ID.
    Required: Yes
  • (string) $meta_key Metadata name.
    Required: Yes
  • (mixed) $meta_value Metadata value. Must be serializable if non-scalar.
    Required: Yes
  • (bool) $unique Optional. Whether the same key should not be added. Default false.
    Required: No
    Padrão: false
  • (int|false) Meta ID on success, false on failure.
Definido em:

Adds metadata to a site.


function add_site_meta( $site_id, $meta_key, $meta_value, $unique = false ) {
	// Bail if site meta table is not installed.
	if ( ! is_site_meta_supported() ) {
		/* translators: %s: database table name */
		_doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.0.0' );
		return false;

	$added = add_metadata( 'blog', $site_id, $meta_key, $meta_value, $unique );

	// Bust site query cache.
	if ( $added ) {
		wp_cache_set( 'last_changed', microtime(), 'sites' );

	return $added;