Options
All
  • Public
  • Public/Protected
  • All
Menu

Module commands/create-term

Index

Functions

Functions

  • createTerm(name?: string, taxonomy?: string, options?: { beforeSave?: CallableFunction; description?: string; parent?: string | number; slug?: string }): void
  • Create a Term of a given taxonomy

    example

    Create new category with default name "Test category"

    cy.createTerm()
    
    example

    Create new category with given name

    cy.createTerm('Category')
    
    example

    Create a category and use it's ID

    cy.createTerm('Category').then(term => {
    cy.log(term.term_id);
    });
    example

    Create new term in a product taxonomy

    cy.createTerm('Product name', 'product')
    
    example

    Create child category for existing Parent with custom description and slug

    cy.createTerm('Child', 'category', {
    parent: 'Parent',
    slug: 'child-slug',
    description: 'Custom description'
    })

    Parameters

    • name: string = 'Test category'

      Term name

    • taxonomy: string = 'category'

      Taxonomy

    • options: { beforeSave?: CallableFunction; description?: string; parent?: string | number; slug?: string } = {}

      { slug - Taxonomy slug parent - Parent taxonomy (ID or name) description - Taxonomy description beforeSave - Callable function hook }

      • Optional beforeSave?: CallableFunction
      • Optional description?: string
      • Optional parent?: string | number
      • Optional slug?: string

    Returns void

Generated using TypeDoc