Introduce `orderby=include` support for `get_terms()`.

Props wpsmith.
Fixes #23261.
Built from https://develop.svn.wordpress.org/trunk@30052


git-svn-id: http://core.svn.wordpress.org/trunk@30052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2014-10-28 18:13:19 +00:00
parent 550dc1a3de
commit bd48b40cc4
2 changed files with 4 additions and 1 deletions

View File

@ -1712,6 +1712,9 @@ function get_terms( $taxonomies, $args = '' ) {
$orderby = 't.name'; $orderby = 't.name';
} else if ( 'slug' == $_orderby ) { } else if ( 'slug' == $_orderby ) {
$orderby = 't.slug'; $orderby = 't.slug';
} else if ( 'include' == $_orderby && ! empty( $args['include'] ) ) {
$include = implode( ',', array_map( 'absint', $args['include'] ) );
$orderby = "FIELD( t.term_id, $include )";
} else if ( 'term_group' == $_orderby ) { } else if ( 'term_group' == $_orderby ) {
$orderby = 't.term_group'; $orderby = 't.term_group';
} else if ( 'none' == $_orderby ) { } else if ( 'none' == $_orderby ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.1-alpha-30051'; $wp_version = '4.1-alpha-30052';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.