Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    jeherve_post_embed_base_api_url is not a shortcode parameter, you won’t be able to use it this way.

    Instead, I’d recommend that you follow the instructions here to get posts from a specific WPML language:
    https://jeremy.hu/rest-api-post-embeds-alter-api-query-shortcode-parameter/

    You can read more about this in this thread:
    https://wordpress.org/support/topic/retrieving-wmpl-posts

    Thread Starter gatsu1981

    (@gatsu1981)

    Hello,

    I added the code on your page inside my theme functions.php.

    But even after that, this is the result: WPAPI it is just NEVER working.

    http://www.milanocard.it/de/post-embed-de

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    Could you check my reply here, as one of your caching plugins appears to be causing issues with responses from the WP REST API?

    You will also need to make sure you’re using both the WP REST API plugin as well as the WP REST API multilanguage (over WMPL) plugin to be able to retrieve posts from specific languages.

    Once you’ve done so, something like this should work:

    [jeherve_post_embed url="http://news.milanocard.it" lang="de" wpapi="true" number="12"]

    Thread Starter gatsu1981

    (@gatsu1981)

    WP REST over WMPL was already installed.

    Caching is enabled on both sites, but it’s not causing any error on the main english page, where embed is used but not with WPREST but in JETPACK mode.

    BTW, I cannot see any error like

    `<!– html is corrupted –>

    Here: http://news.milanocard.it/wp-json/wp/v2/posts?lang=de

    It seemd JSON is perfectly good.

    I’m trying to disable cache BTW.
    Where should I disable, on the “receiving” site or on the “sending” site or both?

    Thread Starter gatsu1981

    (@gatsu1981)

    OK, it seems like a caching issue.
    I added the rule to WPFC: if request url contains “json” then it will not be redirected to cached version.
    This way I can keep the caching ON.

    Thank you my friend, you saved me a lot of time.

    Thread Starter gatsu1981

    (@gatsu1981)

    Hello,

    It worked for a week.
    Today my client mailed me and said that it’s returning:

    Error in the response. We cannot load blog data at this time.

    Even on the first implementation, where lang code was not used.

    http://www.milanocard.it/de/

    [jeherve_post_embed url=”news.milanocard.it” wpapi=”true” number=”7″ headline=”” wrapper_class=”” include_credits=”false” lang=”de”]

    http://www.milanocard.it/fr/
    [jeherve_post_embed url=”news.milanocard.it” wpapi=”true” number=”7″ headline=”” wrapper_class=”” include_credits=”false” lang=”fr”]

    http://www.milanocard.it/
    [jeherve_post_embed url=”http://news.milanocard.it&#8221; headline= wrapper_class=”” include_credits=false number=6]

    I totally disabled cache on news.milanocard.it, but it’s not working, even if http://news.milanocard.it/wp-json/wp/v2/posts is good and updated.

    JSON seems OK:

    http://news.milanocard.it/wp-json/wp/v2/posts
    http://news.milanocard.it/wp-json/wp/v2/posts?lang=de
    http://news.milanocard.it/wp-json/wp/v2/posts?lang=fr

    What could be the problem?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    Error in the response. We cannot load blog data at this time.

    It looks like the site’s server is just too slow to return data. Here is the response I get when trying to query for posts on your site:

    cURL error 28: Operation timed out after 5000 milliseconds with 0 out of -1 bytes received

    You can find out more about what could cause such issues here:
    https://www.wormly.com/answers/sid/130/topicid/19

    Causes of this may include – but are not limited to:
    – An overloaded web server
    – Congested bandwidth resulting in slow transfers from your server
    – A slow running web application
    – Excessively large web page size

    [jeherve_post_embed url=”http://news.milanocard.it&#8221; headline= wrapper_class=”” include_credits=false number=6]

    This isn’t correct. You need to include wpapi="true", as well as quotation marks around false in include_credits=false

    Thread Starter gatsu1981

    (@gatsu1981)

    Can’t I just set the timeout on > 5000? It’s a wordpress, apache or plugin setting?
    The website relies on the html cache for being speedy, WordPress is pretty heavy on the server.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    Can’t I just set the timeout on > 5000? It’s a wordpress, apache or plugin setting?

    It’s a server setting that can be changed with HTTP sensors, as mentioned at the link I posted above. However, it might be worth looking into why the query takes so long on your site, instead of increasing the timeout value.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘WPAPI not working, even if JSON is good’ is closed to new replies.