WooCommerce API Returns 401
So for whatever reason, I could get it to work on my instance on wpengine, but not my local. I’d have to assume this is something to with the way my local is configured. thanks.
So for whatever reason, I could get it to work on my instance on wpengine, but not my local. I’d have to assume this is something to with the way my local is configured. thanks.
Extending the API I created to return category names
In your coupon_lines array, each item in the array needs 2 properties: code (the coupon code itself) and amount, which is either a flat fee (eg 50.00 off) or a discount (eg 10% off). Your structure ends up looking like: “coupon_lines”: [ { “code”: “MYCODE1”, “amount”: “10.00” }, { “code”: “MYCODE2”, “amount”: “25.00” } ] … Read more
WP-API Content showing null
Create Posts from API response without duplicates
When updating a user with: $user_id = wp_update_user( $userdata ); you need to have the user ID set within $userdata. Also make sure to validate the $user_id output of wp_update_user() as it can be either an integer or an instance of WP_Error, before using it in update_user_meta(). One can use is_wp_error( $user_id ) to check … Read more
How to use the WordPress API to get links and scripts in and
If you’re supplying the request data/body like so, which is an array of metadata: { metadata: { wishlist_array: “add this”, foo: “bar baz” } } and you want to update only the wishlist_array metadata, then you could do: // In your case, $field_value is the `metadata` value and $data is a WP_Post object. ‘update_callback’ => … Read more
Please write function for get post by title function get_page_by_post_title( $page_title, $output = OBJECT, $post_type=”page” ) { global $wpdb; $sql = $wpdb->prepare( ” SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type = %s ORDER BY ID DESC “, $page_title, $post_type ); $page = $wpdb->get_var( $sql ); if ( $page ) { return get_post( … Read more
Deleting media using the WordPress Rest API