• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress develop tests

WordPress develop tests

WordPress develop tests a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / WP_UnitTest_Factory_For_Term::create_and_get() – Create a term and returns it as a object.

You appear to be a bot. Output may be restricted

Description

Create a term and returns it as an object.

Usage

$WP_Term|WP_Error|null = WP_UnitTest_Factory_For_Term::create_and_get( $args, $generation_definitions );

Parameters

$args
( array ) optional – Array or string of arguments for inserting a term.
$generation_definitions
( null ) optional – The default values.

Returns

WP_Term|WP_Error|null WP_Term on success. WP_Error if taxonomy does not exist. Null for miscellaneous failure.

Source

File name: wordpress-develop-tests/phpunit/includes/factory/class-wp-unittest-factory-for-term.php
Lines:

1 to 10 of 10
  public function create_and_get( $args = array(), $generation_definitions = null ) {
    $term_id = $this->create( $args, $generation_definitions );

    if ( is_wp_error( $term_id ) ) {
      return $term_id;
    }

    $taxonomy = isset( $args['taxonomy'] ) ? $args['taxonomy'] : $this->taxonomy;
    return get_term( $term_id, $taxonomy );
  }
 

 View on GitHub

Published: 26th November 2019 | Last updated: 26th November 2019

Primary Sidebar

Information

Function name: WP_UnitTest_Factory_For_Term::create_and_get
Class ref: WP_UnitTest_Factory_For_Term
Plugin ref: WordPress develop tests
Version: 5.9.3
Sourcefile: phpunit/includes/factory/class-wp-unittest-factory-for-term.php
File ref: phpunit/includes/factory/class-wp-unittest-factory-for-term.php
Deprecated?: No
API Letters: F,T,U,W

Footer

WordPress develop tests
WordPress develop tests
WordPress develop tests a2z
WordPress 6.3.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  develop.wp-a2z.org
© Copyright WordPress develop tests 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites