Get ID of current taxonomy in register_rest_field

The get_callback part is generated within the WP_REST_Controller::add_additional_fields_to_object() method with: $object[ $field_name ] = call_user_func( $field_options[‘get_callback’], $object, $field_name, $request, $this->get_object_type() ); That means the callback has four input arguments: ‘get_callback’ => function ( $object, $field_name, $request, $object_type ) { // … } and for the requested category object, we can get the term id with: … Read more

Get term by custom term meta and taxonomy

Try This: $args = array( ‘hide_empty’ => false, // also retrieve terms which are not used yet ‘meta_query’ => array( array( ‘key’ => ‘feature-group’, ‘value’ => ‘kitchen’, ‘compare’ => ‘LIKE’ ) ), ‘taxonomy’ => ‘category’, ); $terms = get_terms( $args );

Using get_terms() with meta_query parameters

Inserting boolean term meta values When we add non-existent term meta with e.g. add_term_meta( 123, ‘test’, true ); then we are actually running the following insert : $wpdb->insert( ‘wp_termmeta’, array( ‘term_id’ => 123, ‘meta_key’ => ‘test’, ‘meta_value’ => true ) ); within the general add_metadata() function. Now wpdb::insert() is actually a wrapper for wpdb::_insert_replace_helper() that … Read more

Create taxonomy with meta term using the WP Rest Api

I think you need an update_callback in register_rest_field(). Please note that I haven’t tested this. add_action( ‘rest_api_init’, ‘slug_register_meta’ ); function slug_register_meta() { register_rest_field( ‘place’, ‘meta’, array( ‘get_callback’ => ‘slug_get_meta’, ‘update_callback’ => ‘slug_update_meta’, ‘schema’ => null, ) ); } function slug_get_meta( $object, $field_name, $request ) { return get_term_meta( $object[ ‘id’ ] ); } function slug_update_meta($value, $object, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)