Disable the generation of the table of content using custom conditions.

The function must return true to disable the generation of the TOC.


$value: $value is set to false by default, you should ignore this parameter.

$content: Current post content.

$post: $post object.

add_filter('joli_toc_disable_toc_custom', 'toc_disable', 10, 3);

function toc_disable($value, $content, $post)
    //TOC will be disabled if the page contains the word "travel"
    if (strpos($content, 'travel') !== false) {
        return true;

    //default to false
    return $value;
Was this page helpful?