| @@ -232,8 +232,17 @@ | ||
| 232 | 232 | * @param array $items Non-empty steps. |
| 233 | 233 | * @return void |
| 234 | 234 | */ |
| 235 | 235 | private function maybe_render_schema(array $settings, array $items): void { |
| 236 | + | |
| 237 | + // The Schema master switch and the matrix's per-content-type switch. | |
| 238 | + // This widget echoes its own <script> rather than registering with | |
| 239 | + // Schema_Graph, so gating the graph never reached it and it kept | |
| 240 | + // publishing with Schema switched off (#688). | |
| 241 | + if (class_exists('ThinkRank\\Frontend\\Schema_Graph') | |
| 242 | + && !\ThinkRank\Frontend\Schema_Graph::output_allowed()) { | |
| 243 | + return; | |
| 244 | + } | |
| 236 | 245 | if ('yes' !== ($settings['output_schema'] ?? 'yes')) { |
| 237 | 246 | return; |
| 238 | 247 | } |
| 239 | 248 | |
| @@ -292,8 +301,8 @@ | ||
| 292 | 301 | } |
| 293 | 302 | |
| 294 | 303 | $json = wp_json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); |
| 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 | } |