how to show product custom taxonomies in woocommerce rest api

I eventually found a way using filters. I didn’t know there were filters for REST API responses… Here is my solution : add_filter( ‘woocommerce_rest_prepare_product’, ‘custom_products_api_data’, 90, 2 ); function custom_products_api_data( $response, $post ) { // retrieve a custom field and add it to API response $response->data[‘custom_taxonomy1’] = wp_get_post_terms( $post->ID, ‘custom_taxonomy1’, [] ); $response->data[‘custom_taxonomy2’] = wp_get_post_terms( … Read more

Error rest_post_invalid_page_number trying to call Rest API

I don’t know why yet, but I had the same issue until I disabled a filter on pre_get_posts. What I’m doing here is retrieve all recipe custom post type when I’m on the home page : // add_filter( ‘pre_get_posts’, ‘my_get_posts’ ); function my_get_posts( $query ) { if ( is_home() && $query->is_main_query() ) $query->set( ‘post_type’, array( … Read more

REST api header link href

Turns out it was there all along, but being rendered into an html tag during the output. I ended up using; echo htmlspecialchars($response); To get this to be displayed correctly on the page. Although I want to be checking against it in php, which I haven’t go to figuring out yet, it is nice to … Read more

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