| @@ -93,9 +93,16 @@ | ||
| 93 | 93 | $output .= '</div>'; |
| 94 | 94 | |
| 95 | 95 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 96 | 96 | |
| 97 | - $this->render_builder_script($uid, $max_level, !empty($settings['output_schema'])); | |
| 97 | + // The TOC schema is built client-side, so it bypasses both Schema_Graph | |
| 98 | + // and the block filter and kept publishing an ItemList with Schema | |
| 99 | + // switched off (#688). | |
| 100 | + $schema = !empty($settings['output_schema']) | |
| 101 | + && (!class_exists('ThinkRank\\Frontend\\Schema_Graph') | |
| 102 | + || \ThinkRank\Frontend\Schema_Graph::output_allowed()); | |
| 103 | + | |
| 104 | + $this->render_builder_script($uid, $max_level, $schema); | |
| 98 | 105 | } |
| 99 | 106 | |
| 100 | 107 | /** |
| 101 | 108 | * The dependency-free script that fills the list in. |
| @@ -190,8 +197,9 @@ | ||
| 190 | 197 | }; |
| 191 | 198 | } ); |
| 192 | 199 | var tag = document.createElement( 'script' ); |
| 193 | 200 | tag.type = 'application/ld+json'; |
| 201 | + tag.setAttribute( 'data-thinkrank', 'toc' ); | |
| 194 | 202 | tag.textContent = JSON.stringify( { |
| 195 | 203 | '@context': 'https://schema.org', |
| 196 | 204 | '@graph': graph |
| 197 | 205 | } ); |