Fetching Elementor Content via WordPress REST API:

add_action("rest_api_init", function () {
    register_rest_route("custom/v1", "/pages/(?P<id>\d+)/elementor", [
        "methods" => "GET",
        "callback" => function (\WP_REST_Request $req) {
            $post_id = $req->get_param("id");
            if (class_exists("\\Elementor\\Plugin")) {
                // Returns the fully rendered HTML layout from Elementor
                return \Elementor\Plugin::$instance->frontend->get_builder_content_for_display($post_id);
            }
            return new WP_Error('no_elementor', 'Elementor is not active', ['status' => 404]);
        }
    ]);
});
Sitemap
Posts
🎊🥳🎈🎉

Mensagem enviada com sucesso!

Em breve retornaremos o seu contato.