Make WordPress Core

Changeset 37142


Ignore:
Timestamp:
03/30/2016 05:42:44 PM (7 years ago)
Author:
nbachiyski
Message:

Taxonomies: make sure taxonomy functions work correctly with taxonomy names with special characters

The codex says that taxonomy names "should only contain lowercase letters and the underscore character", but that's not enforced. It's too late to enforce it, since some plugins haven't been following it and the official phpdoc doesn't mention this restriction.

Merge of [37133] to the 3.7 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7/src/wp-includes/taxonomy.php

    r25936 r37142  
    588588    $term_ids = array_map('intval', $term_ids );
    589589
    590     $taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
     590    $taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
    591591    $term_ids = "'" . implode( "', '", $term_ids ) . "'";
    592592
     
    13471347        $order = 'ASC';
    13481348
    1349     $where = "tt.taxonomy IN ('" . implode("', '", $taxonomies) . "')";
     1349    $where = "tt.taxonomy IN ('" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "')";
    13501350    $inclusions = '';
    13511351    if ( ! empty( $include ) ) {
     
    20302030        $order = 'ASC';
    20312031
    2032     $taxonomies = "'" . implode("', '", $taxonomies) . "'";
     2032    $taxonomies = "'" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
    20332033    $object_ids = implode(', ', $object_ids);
    20342034
Note: See TracChangeset for help on using the changeset viewer.