WP Gutenberg – How to parse simple images?

When you return $post->post_content you’re returning the raw content from the database. Things like shortcodes, dynamic blocks and responsive image markup will not exist in the content. To prepare content for output you need to run it through the the_content filter: ‘content’ => apply_filters( ‘the_content’, $post->post_content ), That being said, there is already an endpoint … Read more

How to add fee_lines using woocommerce rest API v3?

Here is my code that working fine. “fee_lines”: [ { “name”: “7.5% Booking Fee”, “tax_status”: “taxable”, “tax_class”: “”, “total”: “26.02”, “total_tax”: “26.02”, “taxes”: [], “meta_data”: [] }, { “name”: “Waiter Tip (5%)”, “tax_status”: “taxable”, “tax_class”: “”, “total”: “8.00”, “total_tax”: “8.00”, “taxes”: [], “meta_data”: [] } ]

How can I get the number of items stored under a cache group

Here is an untested one-liner, counting the cache data array returned from the magic __get method, with a fallback to an empty array if the group key is not set: ‘numberOfEntries’ => count( $wp_object_cache->cache[$group] ?? [] ); Another approach is to consider bindTo to access the private cache array of the $wp_object_cache instance via closure.

Is it a good idea to restrict the REST API

You can use the rest_dispatch_request filter to catch the /wp/v2/users routes before they deliver their data to the user. add_filter( ‘rest_dispatch_request’, ‘wpse425815_authenticate_user_route’, 10, 4 ); /** * Forces authentication on the wp/v2/user route(s). * * @param mixed $result The current result. * @param WP_Request $request The REST request. * @param string $route The requested route. … Read more