Is there a way to save template data into wp_post table?

I made a custom template that automatically makes tables and some sentences with the meta-data that users insert in. I wanted to make users choose a template and write in a standardized format with custom field. enter image description here Users can now just put some text on my custom field (bottom of my post edit page) and click the template on the sidebar, then the contents show on the post page!

And part of my code on single.php (post page) is this and this is working perfectly.

<?php the_content();    
                    if ( is_page_template('hkb-templates/coin-info-template.php') ) { 
                    hkb_get_template_part( 'coin-info-template' );
                    else {

However, I noticed that with this code, table of content plugin doesn't work :( . I realized TOC plugin checks the contents inside of wp_post table (post_content column) but my template does not save the data into SQL database. It just make contents displayed on the post page. So my content is invisible to TOC plugin. Any suggestions or ideas to solve this problem? Please help me.

  • Honestly the proper way to do this sort of thing these days would be to implement this as a custom Block. Commented Jun 3, 2022 at 12:31
  • @JacobPeattie ohhhhhh that might work... Commented Jun 3, 2022 at 12:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.