Changeset 49947
- Timestamp:
- 01/08/2021 03:22:17 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-term-query.php
r49946 r49947 286 286 287 287 /** 288 * Sets up the query for retrieving terms. 288 * Sets up the query and retrieves the results. 289 * 290 * The return type varies depending on the value passed to `$args['fields']`. See 291 * WP_Term_Query::get_terms() for details. 289 292 * 290 293 * @since 4.6.0 291 294 * 292 295 * @param string|array $query Array or URL query string of parameters. 293 * @return array|int List of terms, or number of terms when 'count' is passed as a query var. 296 * @return WP_Term[]|int[]|string[]|string Array of terms, or number of terms as numeric string 297 * when 'count' is passed as a query var. 294 298 */ 295 299 public function query( $query ) { … … 299 303 300 304 /** 301 * Get terms, based on query_vars. 305 * Retrieves the query results. 306 * 307 * The return type varies depending on the value passed to `$args['fields']`. 308 * 309 * The following will result in an array of `WP_Term` objects being returned: 310 * 311 * - 'all' 312 * - 'all_with_object_id' 313 * 314 * The following will result in a numeric string being returned: 315 * 316 * - 'count' 317 * 318 * The following will result in an array of text strings being returned: 319 * 320 * - 'id=>name' 321 * - 'id=>slug' 322 * - 'names' 323 * - 'slugs' 324 * 325 * The following will result in an array of numeric strings being returned: 326 * 327 * - 'id=>parent' 328 * 329 * The following will result in an array of integers being returned: 330 * 331 * - 'ids' 332 * - 'tt_ids' 333 * 334 * In all cases, a `WP_Error` object will be returned if an invalid taxonomy is used. 302 335 * 303 336 * @since 4.6.0 … … 305 338 * @global wpdb $wpdb WordPress database abstraction object. 306 339 * 307 * @return array List of terms. 340 * @return WP_Term[]|int[]|string[]|string Array of terms, or number of terms as numeric string 341 * when 'count' is passed as a query var. 308 342 */ 309 343 public function get_terms() { -
trunk/src/wp-includes/taxonomy.php
r49935 r49947 1132 1132 1133 1133 /** 1134 * Retrieve the terms in a given taxonomy or list of taxonomies.1134 * Retrieves the terms in a given taxonomy or list of taxonomies. 1135 1135 * 1136 1136 * You can fully inject any customizations to the query before it is sent, as 1137 1137 * well as control the output with a filter. 1138 * 1139 * The return type varies depending on the value passed to `$args['fields']`. See 1140 * WP_Term_Query::get_terms() for details. In all cases, a `WP_Error` object will 1141 * be returned if an invalid taxonomy is requested. 1138 1142 * 1139 1143 * The {@see 'get_terms'} filter will be called when the cache has the term and will … … 1178 1182 * function parameter will be parsed as a taxonomy or array of taxonomies. 1179 1183 * Default empty. 1180 * @return WP_Term[]|int|WP_Error Array of WP_Term instances, a count thereof, 1181 * or WP_Error if any of the taxonomies do not exist. 1184 * @return WP_Term[]|int[]|string[]|string|WP_Error Array of terms, a count thereof as a numeric string, 1185 * or WP_Error if any of the taxonomies do not exist. 1186 * See the function description for more information. 1182 1187 */ 1183 1188 function get_terms( $args = array(), $deprecated = '' ) { … … 1746 1751 * function parameter will be parsed as a taxonomy or array of taxonomies. 1747 1752 * Default empty. 1748 * @return array|int|WP_Error Number of terms in that taxonomy or WP_Error if the taxonomy does not exist. 1753 * @return string|WP_Error Numeric string containing the number of terms in that 1754 * taxonomy or WP_Error if the taxonomy does not exist. 1749 1755 */ 1750 1756 function wp_count_terms( $args = array(), $deprecated = '' ) { -
trunk/tests/phpunit/tests/term/wpInsertTerm.php
r48937 r49947 44 44 $this->assertNull( term_exists( $term ) ); 45 45 $this->assertNull( term_exists( $t['term_id'] ) ); 46 $this->assert Equals( $initial_count, wp_count_terms( array( 'taxonomy' => $taxonomy ) ) );46 $this->assertSame( $initial_count, wp_count_terms( array( 'taxonomy' => $taxonomy ) ) ); 47 47 } 48 48
Note: See TracChangeset
for help on using the changeset viewer.