detail item not flushed after mutation
-
Hi,
Using your plugin, a problem with a single/detail custom rest api item occured. It was not flushed after the content of that single item is changed.
The index endpoint of that custom endpoint was however flushed successfully.
Got some images to show what happens.
We create a new item, and see it correctly in the endpoint index and detail:
Than we change that item:
And than after a reload of the index endpoint:
after-change-after-refresh-settings.png
And then the code to enable the custom endpoint:
/** * Register the /wp-json/owc/openpub/v1/* endpoint so it will be cached. */ add_filter( 'wp_rest_cache/allowed_endpoints',function( $allowed_endpoints ) { if ( ! isset( $allowed_endpoints[ 'owc/openpub/v1' ] ) || ! in_array( 'items', $allowed_endpoints[ 'owc/openpub/v1' ] ) ) { $allowed_endpoints[ 'owc/openpub/v1' ][] = 'items'; } return $allowed_endpoints; }, 10, 1);
And the code to determine the entity
/** * Add determination to entities. */ add_filter( 'wp_rest_cache/determine_object_type',function( $object_type, $cache_key, $data, $uri ) { if ( 'unknown' !== $object_type || strpos( $uri, '/owc/openpub/v1/' ) === false ) { return $object_type; } if ( false !== strpos( $uri, '/wp-json/owc/openpub/v1/items' ) ) { $object_type = 'openpub-item'; } return $object_type; }, 10, 4);
Can you tell me what is going wrong here, so we can use your plugin to it’s full capacity?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘detail item not flushed after mutation’ is closed to new replies.