Is there a way to make [Table Of Content] plugin while not using revision data?

I have a problem while using TOC plugins 'cause all of TOC plugins use revision data to recognize header tag. I'm using my own metadata (custum field) plugin and the data doens't show on the revision page. It means that the TOC plugins can not recognize my header tag data on the post page. Any great ideas?
This is one of the TOC plugins and you could see the get the revision

public function widget( $args, $instance ) {
        global $ht_kb_toc_tools, $wp_query;

        if( ! is_singular() )
            return;

        if ( ! isset( $wp_query ) ) {
            return;
        }


        if( is_a($ht_kb_toc_tools, 'HT_KB_TOC_Tools') ){
            if( $ht_kb_toc_tools-ht_block_toc_detected  apply_filters('ht_kb_toc_disable_on_ht_block_toc', true ) ){
                //early exit if ht-block-toc detected
                return;    
            }                
        }

        extract( $args, EXTR_SKIP );

        $instance = wp_parse_args( $instance, $this-defaults );

        //$post = get_post( $wp_query-post-ID );
        $post = get_post();

        if( is_preview() ){
            //get the post revisions
            $post_revisions = ( wp_get_post_revisions( $post ) );

            if ( !empty( $post_revisions ) ) {
                //get the latest revision - this should be the current preview
                $post = current( $post_revisions );
            }
        }

        $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this-id_base );   

        if(is_a($ht_kb_toc_tools, 'HT_KB_TOC_Tools')){

            //extract headings
            $headings = $ht_kb_toc_tools-ht_kb_toc_extract_headings( do_shortcode( $post-post_content ), true ); 

            //don't output widget if no headings are in content
            if(empty($headings))
                return;

            echo $before_widget;

            if ( $title )
                echo $before_title . $title . $after_title;


            ?
            nav id=navtoc role=navigation

                

            ?php
            //display items
            $ht_kb_toc_tools-ht_kb_display_items();
            ?

            /nav

            ?php
        }

        echo $after_widget;

    } // end widget

Topic post-meta custom-field posts plugins Wordpress

Category Web


The only reason it's talking about revisions is so the TOC still displays when you preview a post. It's nothing to do with your problem, which is that the TOC plugins are looking at your post content, but you're using page builders that store data in post meta. Unless the TOC plugin was built specifically to work with that page builder it can't see the data.

Otherwise, there is no general solution to your problem, it is not possible to write an answer that covers all plugins.

You will need to find a specific solution for the combination of specific TOC and page builder plugin that you want to use. There is no generic way that works for all of them.

For example, the answer for Elementor + Heroic table of contents will not be the same as Elementor + Table of contents plus, or beaver builder + heroic.

To find those solutions you will need to ask their support routes or other users in their communities. No one size fits all solution exists.

Alternatively, switch to a page builder that stores its data in the post content, or provides its own table of contents functionality.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.