Hi there,
I built a custom dynamic block that calls the WordPress PHP function get_the_ID() in render.php. The custom block works fine on the public face of the site. When the custom block is inserted into a view created via the block editor, however, it doesn't work correctly. The reason is that get_the_ID() returns the ID of the current View, not the ID of the post in the view's loop.
My short-term solution is to identify the post type of the given ID and ignore the post type "view-template" (and "revision," another post type the block editor uses). Does Toolset recommended another approach to handle this? How can I obtain the "correct" post ID?
Thank you.
Saul