WP_Terms_List_Table::single_row() WordPress Method
The WP_Terms_List_Table::single_row() method is used to display a single term in the terms list table. This method takes two parameters: $term - The term object to be displayed $taxonomy - The taxonomy associated with the term The method first checks if the current user has the 'edit_terms' capability for the taxonomy. If the user does not have this capability, the term is displayed read-only. Next, the method gets the terms name and slug. These are used to display the term's checkbox, name, and slug. Finally, the method calls the WP_Terms_List_Table::_row_actions() method to display the term's actions (edit, inline-edit, delete, etc).
WP_Terms_List_Table::single_row( WP_Term $tag, int $level ) #
Parameters
- $tag
(WP_Term)(Required)Term object.
- $level
(int)(Required)
Source
File: wp-admin/includes/class-wp-terms-list-table.php
public function single_row( $tag, $level = 0 ) { global $taxonomy; $tag = sanitize_term( $tag, $taxonomy ); $this->level = $level; if ( $tag->parent ) { $count = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) ); $level = 'level-' . $count; } else { $level = 'level-0'; } echo '<tr id="tag-' . $tag->term_id . '" class="' . $level . '">'; $this->single_row_columns( $tag ); echo '</tr>'; }
Expand full source codeCollapse full source codeView on TracView on GitHub