wp_term_is_shared example


function add_term_meta( $term_id$meta_key$meta_value$unique = false ) {
    if ( wp_term_is_shared( $term_id ) ) {
        return new WP_Error( 'ambiguous_term_id', __( 'Term meta cannot be added to terms that are shared between taxonomies.' )$term_id );
    }

    return add_metadata( 'term', $term_id$meta_key$meta_value$unique );
}

/** * Removes metadata matching criteria from a term. * * @since 4.4.0 * * @param int $term_id Term ID. * @param string $meta_key Metadata name. * @param mixed $meta_value Optional. Metadata value. If provided, * rows will only be removed that match the value. * Must be serializable if non-scalar. Default empty. * @return bool True on success, false on failure. */
Home | Imprint | This part of the site doesn't use cookies.