Is there a better way to programmatically insert content into a page?

During activation of the plugin I’m writing, I insert a custom page. I can add post_content using the wp_insert_post command, which seems like a reasonable way to add a limited amount of content.

For example, something simple as part of an array could be:

'post_content'='<h1> Header </h1>'

However, I would like to add a full page of code. Is there a way, such as perhaps linking to a separate file, to insert significant amounts of content? I’ve tried 'post_content' => '<link rel="import" href="https://wordpress.stackexchange.com/questions/292917/./test.html">' but that doesn’t seem to work.

Has anyone found a way to do this other than putting all the code directly into the array?

0

Leave a Comment