Make WordPress Core


Ignore:
Timestamp:
03/30/2016 05:22:51 PM (8 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 4.3 branch.

File:
1 edited

Legend:

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

    r33877 r37136  
    626626    $term_ids = array_map('intval', $term_ids );
    627627
    628     $taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
     628    $taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
    629629    $term_ids = "'" . implode( "', '", $term_ids ) . "'";
    630630
     
    18111811    }
    18121812
    1813     $where = "tt.taxonomy IN ('" . implode("', '", $taxonomies) . "')";
     1813    $where = "tt.taxonomy IN ('" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "')";
    18141814
    18151815    $exclude = $args['exclude'];
     
    27402740    $taxonomy_array = $taxonomies;
    27412741    $object_id_array = $object_ids;
    2742     $taxonomies = "'" . implode("', '", $taxonomies) . "'";
     2742    $taxonomies = "'" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
    27432743    $object_ids = implode(', ', $object_ids);
    27442744
Note: See TracChangeset for help on using the changeset viewer.