WordPress.org

Make WordPress Core

Ticket #22293: 22293.diff

File 22293.diff, 2.0 KB (added by atimmer, 3 years ago)
  • src/wp-content/themes/twentyfifteen/functions.php

     
    2626 */
    2727
    2828/**
     29 * @return Closure
     30 */
     31function set_slug( $slug ) {
     32        //var_dump( $slug );
     33
     34        $slug = 'dit-is-de-slug';
     35
     36        return $slug;
     37}
     38
     39add_filter( 'pre_update_term_slug', 'set_slug' );
     40add_filter( 'pre_insert_term_slug', 'set_slug' );
     41
     42/**
    2943 * Set the content width based on the theme's design and stylesheet.
    3044 *
    3145 * @since Twenty Fifteen 1.0
  • src/wp-includes/taxonomy.php

     
    27702770
    27712771        $slug = wp_unique_term_slug( $slug, (object) $args );
    27722772
     2773        /**
     2774         * Filter a term slug before it is inserted into the database.
     2775         *
     2776         * @since 4.6.0
     2777         *
     2778         * @param string $slug     The proposed slug.
     2779         * @param string $term     The term data to be inserted.
     2780         * @param string $taxonomy Taxonomy slug.
     2781         * @param array  $args     The arguments passed to wp_insert_term
     2782         */
     2783        $slug = apply_filters( 'pre_insert_term_slug', $slug, $term, $taxonomy, $args );
     2784
    27732785        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) {
    27742786                return new WP_Error( 'db_insert_error', __( 'Could not insert term into the database' ), $wpdb->last_error );
    27752787        }
     
    33473359        }
    33483360
    33493361        /**
     3362         * Filter a term slug before it is updated in the database.
     3363         *
     3364         * @since 4.6.0
     3365         *
     3366         * @param string $slug     The updated slug.
     3367         * @param string $term     The old term data.
     3368         * @param string $taxonomy Taxonomy slug.
     3369         * @param array  $args     The arguments passed to wp_update_term
     3370         */
     3371        $slug = apply_filters( 'pre_update_term_slug', $slug, $term, $taxonomy, $args );
     3372
     3373        /**
    33503374         * Fires immediately before the given terms are edited.
    33513375         *
    33523376         * @since 2.9.0