• Resolved andreescocard

    (@andreescocard)


    Hi, i am trying to understand why _embedded is missing from the API, and it returns when the plugin is deactivated.
    I am currently using
    WordPress 5.6.8
    WP REST Cache 2021.4.1
    I use W3 Total Cache but it is deactivated, problem only occurs when i activate WP REST Cache

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter andreescocard

    (@andreescocard)

    I checked this https://www.ads-software.com/support/topic/support-for-the-_embed-query-param/, i am testing on localhost and the define(‘WP_CACHE’, true); is not on wp-config.

    Thread Starter andreescocard

    (@andreescocard)

    A strange behavior is that posts endpoint works fine, it happens on search endpoint only (/wp-json/wp/v2/search?search=test&per_page=12&_embed).
    Actually i get the data i want using register_rest_field, but it seems to be a bug.

    Plugin Author Richard Korthuis

    (@rockfire)

    Hi @andreescocard

    Thank you for using our plugin!

    First of all there is no reason why our plugin wouldn’t cache the _embedded part of the response. We simply take what we get from WordPress and cache it. We do not alter it in any way.
    Second: out-of-the-box our plugin does not (yet) cache the search endpoint. This has to do with some technical issues we have to solve, but also with the fact that caching seems a lot less interesting for the search endpoint (there are unlimited search phrases a user can use and that would result in just as many cache records which would most of the time only be requested once.
    Having said the above: I did try this locally with our plugin caching the search endpoint (using the wp_rest_cache/allowed_endpoints filter). However the _embedded part was present both in the cached as in the uncached version. So I am unable to reproduce the issue. Can it be you have any other plugin or code that does something to the _embedded?

    Thread Starter andreescocard

    (@andreescocard)

    Good question, anyway i solved the issue creating another endpoint.
    I tested disabling another plugins too, the only one i could not disable (shows critical error) is advanced custom fields pro.
    The strange is that it only removes the _embedded when i activate the plugin, if i disable, it shows normally.

    Plugin Author Richard Korthuis

    (@rockfire)

    Good to hear you solved it, but still creating another endpoint shouldn’t be necessary. I will keep an eye out to see if I encounter this issue somewhere else.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Missing _embedded when plugin is activated’ is closed to new replies.