我正在使用Wordpress REST API来检索wordpress页面的呈现内容。
我的页面是用Elementor构建的。然后Elementor在结局页面上添加一些内联CSS以使所有工作正常进行。此内联CSS不存在
API返回的内容。

示例调用:

http://website.com/guide/wp-json/wp/v2/pages/23412

响应:

<h1>My title</h1>

实际页面HTML:

<h1>My title</h1> <style>h1 { color: red; }</style>

我正在寻找的部分(响应中不存在):

<style>h1 { color: red; }</style>

您知道如何使用Wordpress API检索Elementor生成的内联CSS吗?

最佳答案

这里描述的解决方案效果很好:
https://wordpress.stackexchange.com/questions/292849/displaying-a-page-built-with-elementor-using-the-rest-api/292895

收到HTML后,您可以解析页面并获取所有由Elementor生成的内联CSS的<style>标记。

10-07 14:00
查看更多