You appear to be a bot. Output may be restricted
Description
Returns an array suitable for use in the javascript.
Usage
$array = WPSEO_Primary_Term_Admin::map_taxonomies_for_js( $taxonomy );
Parameters
- $taxonomy
- ( stdClass ) required – The taxonomy to map.
Returns
array The mapped taxonomy.
Source
File name: wordpress-seo/admin/class-primary-term-admin.php
Lines:
1 to 33 of 33
private function map_taxonomies_for_js( $taxonomy ) { $primary_term = $this->get_primary_term( $taxonomy->name ); if ( empty( $primary_term ) ) { $primary_term = ''; } $terms = get_terms( [ 'taxonomy' => $taxonomy->name, 'update_term_meta_cache' => false, 'fields' => 'id=>name', ] ); $mapped_terms_for_js = []; foreach ( $terms as $id => $name ) { $mapped_terms_for_js[] = [ 'id' => $id, 'name' => $name, ]; } return [ 'title' => $taxonomy->labels->singular_name, 'name' => $taxonomy->name, 'primary' => $primary_term, 'singularLabel' => $taxonomy->labels->singular_name, 'fieldId' => $this->generate_field_id( $taxonomy->name ), 'restBase' => ( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name, 'terms' => $mapped_terms_for_js, ]; }