I have a requirement where I need to place a post inside a page in Wordpress. For this, I'm using a plugin Insert Pages, which inserts published post's content in another post or page using Shortcode API.
But with too many pages it will be cumbersome to add them by hand, so I'm finding a way to place this shortcode via script or when a new post is created or updated.
Pages are created by Visualcomposer(VC) which is a drag-and-drop page builder, it saves its page structure in a url
json. I have gone through VC's documentation which they provide, and API which is for custom elements but they don't provide any API or hook functionality where we can inject an element in page structure.
I need to place new posts in the page structure with a shortcode element. I tried editing
wp_posts but VC never show this updated
HTML in its editor and it is only shown on preview or live pages from wordpress admin. If this updated
HTML page is opened with VC in editor, and save any change from there, it overrides the
HTML changes I previously did.
Has anybody done something like this or know any hooks I can look into for adding elements in VC page structure?