WordPress.org

Make WordPress Core

Changeset 37141


Ignore:
Timestamp:
03/30/2016 05:40:10 PM (3 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.8 branch.

File:
1 edited

Legend:

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

    r26544 r37141  
    590590    $term_ids = array_map('intval', $term_ids );
    591591
    592     $taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
     592    $taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
    593593    $term_ids = "'" . implode( "', '", $term_ids ) . "'";
    594594
     
    13491349        $order = 'ASC';
    13501350
    1351     $where = "tt.taxonomy IN ('" . implode("', '", $taxonomies) . "')";
     1351    $where = "tt.taxonomy IN ('" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "')";
    13521352    $inclusions = '';
    13531353    if ( ! empty( $include ) ) {
     
    20282028        $order = 'ASC';
    20292029
    2030     $taxonomies = "'" . implode("', '", $taxonomies) . "'";
     2030    $taxonomies = "'" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
    20312031    $object_ids = implode(', ', $object_ids);
    20322032
Note: See TracChangeset for help on using the changeset viewer.