| @@ -235,8 +235,17 @@ | ||
| 235 | 235 | * @param array $items Usable steps. |
| 236 | 236 | * @return void |
| 237 | 237 | */ |
| 238 | 238 | private function maybe_render_schema(array $settings, array $items): void { |
| 239 | + | |
| 240 | + // The Schema master switch and the matrix's per-content-type switch. | |
| 241 | + // This widget echoes its own <script> rather than registering with | |
| 242 | + // Schema_Graph, so gating the graph never reached it and it kept | |
| 243 | + // publishing with Schema switched off (#688). | |
| 244 | + if (class_exists('ThinkRank\\Frontend\\Schema_Graph') | |
| 245 | + && !\ThinkRank\Frontend\Schema_Graph::output_allowed()) { | |
| 246 | + return; | |
| 247 | + } | |
| 239 | 248 | if (empty($settings['output_schema']) || self::in_builder()) { |
| 240 | 249 | return; |
| 241 | 250 | } |
| 242 | 251 | |
| @@ -292,9 +301,9 @@ | ||
| 292 | 301 | |
| 293 | 302 | $json = wp_json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); |
| 294 | 303 | |
| 295 | 304 | if (false !== $json) { |
| 296 | - echo '<script type="application/ld+json">' . $json . '</script>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 305 | + echo '<script type="application/ld+json" data-thinkrank="howto">' . $json . '</script>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 297 | 306 | } |
| 298 | 307 | } |
| 299 | 308 | |
| 300 | 309 | /** |