query.get_term_by

/ Database / query.get_term_by

Title : query.get_term_by
Purpose : To get all the term data from database by term field and data
Syntax :
Input Parameters :
  • field: (string) (required) Either ‘id’, ‘slug’, ‘name’, or ‘term_taxonomy_id’ || Default: none
  • value: (string|integer) (required) Search for this term value || Default: None
  • taxonomy: (string) (required) Taxonomy Name category, post_tag, link_category, nav_menu or something custom || Default: ” (empty string)
  • output: (string) (optional) Constant OBJECT, ARRAY_A, or ARRAY_N || Default: OBJECT
  • filter: (string) (optional) default is raw or no WordPress defined filter will applied. || Default: ‘raw’
Return Value : Term Row (object or array) from database. Will return false if taxonomy does not exist or term was not found. Otherwise returns object (by default) or array of fields depending on output parameter
Example 1 :
Code :
Output :
Description : The above example code will output terms matching field name=additional courses whose taxonomy is category.

 

Categories
Most Popular

Leave a Reply

Your email address will not be published.