WordPress.org

Make WordPress Core

Changeset 34718


Ignore:
Timestamp:
09/30/2015 04:52:28 AM (6 years ago)
Author:
boonebgorges
Message:

Bail out of termmeta functions if schema is not up-to-date.

Termmeta cache priming was throwing database errors on installations that had
not yet gone through the database update routine. To avoid errors in all cases,
the check has been added to all termmeta functions. These checks will be
removed in a future version of WordPress. (Hang on to your hats!)

Fixes #34091.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy-functions.php

    r34704 r34718  
    15021502 */
    15031503function add_term_meta( $term_id, $meta_key, $meta_value, $unique = false ) {
     1504    // Bail if term meta table is not installed.
     1505    if ( get_option( 'db_version' ) < 34370 ) {
     1506        return false;
     1507    }
     1508
    15041509    $added = add_metadata( 'term', $term_id, $meta_key, $meta_value, $unique );
    15051510
     
    15231528 */
    15241529function delete_term_meta( $term_id, $meta_key, $meta_value = '' ) {
     1530    // Bail if term meta table is not installed.
     1531    if ( get_option( 'db_version' ) < 34370 ) {
     1532        return false;
     1533    }
     1534
    15251535    $deleted = delete_metadata( 'term', $term_id, $meta_key, $meta_value );
    15261536
     
    15451555 */
    15461556function get_term_meta( $term_id, $key = '', $single = false ) {
     1557    // Bail if term meta table is not installed.
     1558    if ( get_option( 'db_version' ) < 34370 ) {
     1559        return false;
     1560    }
     1561
    15471562    return get_metadata( 'term', $term_id, $key, $single );
    15481563}
     
    15641579 */
    15651580function update_term_meta( $term_id, $meta_key, $meta_value, $prev_value = '' ) {
     1581    // Bail if term meta table is not installed.
     1582    if ( get_option( 'db_version' ) < 34370 ) {
     1583        return false;
     1584    }
     1585
    15661586    $updated = update_metadata( 'term', $term_id, $meta_key, $meta_value, $prev_value );
    15671587
     
    15861606 */
    15871607function update_termmeta_cache( $term_ids ) {
     1608    // Bail if term meta table is not installed.
     1609    if ( get_option( 'db_version' ) < 34370 ) {
     1610        return;
     1611    }
     1612
    15881613    return update_meta_cache( 'term', $term_ids );
    15891614}
Note: See TracChangeset for help on using the changeset viewer.