Make WordPress Core

Ticket #21258: 21258.diff

File 21258.diff, 1.3 KB (added by AugusGils, 11 years ago)
  • src/wp-admin/includes/ajax-actions.php

    diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
    index 799ef1e..f93199c 100644
    function wp_ajax_ajax_tag_search() { 
    146146
    147147        $results = get_terms( $taxonomy, array( 'name__like' => $s, 'fields' => 'names', 'hide_empty' => false ) );
    148148
     149        /**
     150         * Filter the already added tags to a post/page.
     151         * @since 4.0.0
     152         */
     153        if ( isset( $_GET['addedTags'] ) ) {
     154
     155                foreach ( $results as $key => $value ) {
     156                        if ( in_array( $value, $_GET['addedTags'] ) ) {
     157                                unset( $results[$key] );
     158                        }
     159                }
     160        }
     161
    149162        echo join( $results, "\n" );
    150163        wp_die();
    151164}
  • src/wp-includes/js/jquery/suggest.js

    diff --git src/wp-includes/js/jquery/suggest.js src/wp-includes/js/jquery/suggest.js
    index 87f3012..51a7e87 100644
     
    118118
    119119                                } else {
    120120
    121                                         $.get(options.source, {q: q}, function(txt) {
     121                                        if ( $('.tagchecklist span').length !== 0 ) {
     122
     123                                                var addedTags = [];
     124
     125                                                $('.tagchecklist span').each( function(span){
     126                                                        var spanContent = $(this).html();
     127
     128                                                        spanContent = spanContent.split( ' ' ).pop();
     129
     130                                                        addedTags.push( spanContent );
     131
     132                                                });
     133                                        }
     134
     135                                        $.get(options.source, {q: q, addedTags: addedTags}, function(txt) {
    122136
    123137                                                $results.hide();
    124138