Open wpt00ls opened 4 years ago
@wpt00ls sorry I'm not able to reproduce this. Can you please confirm if you still experience this on the latest version of CDE?
Did you figure out how to get the post ID? I have the same problem.
Confirming this as well - Add me to the list of developers who would love to be able to get the "current" post context (even just the ID) when editing in Divi builder.
@grex22 @cseevinck @wpt00ls can you pls try ETBuilderBackendDynamic.postId
& let me know if it works for you?
Any development on this? I would also like Divi Visual Builder to send the current Post ID through the iframe request. Otherwise, shortcodes that rely on the current post data cannot be previewed on Divi Builder. This looks like an easy change to be made.
Anyone figure this out?
Problem Description
I've created a shortcode (am a 3rd party divi developer) that uses post ID as one of the attributes. If no post ID is supplied, the post ID of the current page is used.
When adding the shortcode (without the post ID attribute) to the divi text/code module in visual builder, I am unable to get the post ID of the page being edited currently.
It's due to a iframe request that divi visual builder makes http://mywebsitedomain.com/?et_pb_preview=true&et_pb_preview_nonce=0f1a73accf&iframe_id=et-fb-preview-1594791272692-634 . It triggers a new page request in WordPress and we loose the context of the page.
Ideally this request should include the post ID and also provide some hooks for developers to listen into (via javascript) before the iframe request is made.
Steps To Reproduce
Screenshot and/or gif