Changeset 3443686
- Timestamp:
- 01/21/2026 01:23:09 AM (2 months ago)
- Location:
- rank-authority
- Files:
-
- 6 added
- 2 edited
-
tags/1.0.12 (added)
-
tags/1.0.12/assets (added)
-
tags/1.0.12/assets/icon.svg (added)
-
tags/1.0.12/rank-authority.php (added)
-
tags/1.0.12/readme.txt (added)
-
tags/1.0.12/uninstall.php (added)
-
trunk/rank-authority.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rank-authority/trunk/rank-authority.php
r3442843 r3443686 4 4 * Plugin URI: https://rankauthority.com/plugins/rankauthority 5 5 * Description: Secure API connector to publish posts / overwrite posts from the RA Dashboard to WordPress. 6 * Version: 1.0.1 16 * Version: 1.0.12 7 7 * Author: Rank Authority 8 8 * Author URI: https://rankauthority.com … … 32 32 add_action('rest_api_init', [$this, 'register_routes']); 33 33 add_action('wp_enqueue_scripts', [$this, 'enqueue_seo_scripts']); 34 add_action('wp_head', [$this, 'output_schema_markup'], 1); 34 35 } 35 36 … … 673 674 $website_id = get_option($this->option_website_id); 674 675 $token = get_option($this->option_token); 675 $plugin_version = get_file_data(__FILE__, array('Version' => 'Version'), false)['Version'] ?? '1.0.1 1';676 $plugin_version = get_file_data(__FILE__, array('Version' => 'Version'), false)['Version'] ?? '1.0.12'; 676 677 677 678 ?> … … 1133 1134 } 1134 1135 1136 // Set schema if provided 1137 if (!empty($params['schema'])) { 1138 $schema_data = $params['schema']; 1139 1140 // If schema is a string, try to decode it as JSON 1141 if (is_string($schema_data)) { 1142 $decoded = json_decode($schema_data, true); 1143 if (json_last_error() === JSON_ERROR_NONE) { 1144 $schema_data = $decoded; 1145 } 1146 } 1147 1148 // Ensure schema is valid JSON 1149 if (is_array($schema_data) || is_object($schema_data)) { 1150 $schema_json = json_encode($schema_data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); 1151 1152 // Store schema in post meta for multiple SEO plugins 1153 // Generic schema storage 1154 update_post_meta($post_id, '_rank_authority_schema', $schema_json); 1155 1156 // Yoast SEO schema support 1157 update_post_meta($post_id, '_yoast_wpseo_schema', $schema_json); 1158 1159 // Rank Math schema support 1160 update_post_meta($post_id, 'rank_math_schema', $schema_json); 1161 1162 // All in One SEO schema support 1163 update_post_meta($post_id, '_aioseo_schema', $schema_json); 1164 } 1165 } 1166 1135 1167 $permalink = get_permalink($post_id); 1136 1168 … … 1253 1285 } 1254 1286 1287 // Update schema if provided 1288 if (isset($params['schema'])) { 1289 if (!empty($params['schema'])) { 1290 $schema_data = $params['schema']; 1291 1292 // If schema is a string, try to decode it as JSON 1293 if (is_string($schema_data)) { 1294 $decoded = json_decode($schema_data, true); 1295 if (json_last_error() === JSON_ERROR_NONE) { 1296 $schema_data = $decoded; 1297 } 1298 } 1299 1300 // Ensure schema is valid JSON 1301 if (is_array($schema_data) || is_object($schema_data)) { 1302 $schema_json = json_encode($schema_data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); 1303 1304 // Store schema in post meta for multiple SEO plugins 1305 // Generic schema storage 1306 update_post_meta($updated_id, '_rank_authority_schema', $schema_json); 1307 1308 // Yoast SEO schema support 1309 update_post_meta($updated_id, '_yoast_wpseo_schema', $schema_json); 1310 1311 // Rank Math schema support 1312 update_post_meta($updated_id, 'rank_math_schema', $schema_json); 1313 1314 // All in One SEO schema support 1315 update_post_meta($updated_id, '_aioseo_schema', $schema_json); 1316 } 1317 } else { 1318 // If schema is empty, delete schema data 1319 delete_post_meta($updated_id, '_rank_authority_schema'); 1320 delete_post_meta($updated_id, '_yoast_wpseo_schema'); 1321 delete_post_meta($updated_id, 'rank_math_schema'); 1322 delete_post_meta($updated_id, '_aioseo_schema'); 1323 } 1324 } 1325 1255 1326 $permalink = get_permalink($updated_id); 1256 1327 … … 1396 1467 ]; 1397 1468 } 1469 1470 /** 1471 * Output schema markup in wp_head 1472 * Adds JSON-LD structured data to the page head 1473 */ 1474 public function output_schema_markup() { 1475 // Only output on single post/page 1476 if (!is_singular()) { 1477 return; 1478 } 1479 1480 global $post; 1481 if (!$post) { 1482 return; 1483 } 1484 1485 // Get schema from post meta 1486 $schema_json = get_post_meta($post->ID, '_rank_authority_schema', true); 1487 1488 if (empty($schema_json)) { 1489 return; 1490 } 1491 1492 // Validate JSON 1493 $schema_data = json_decode($schema_json, true); 1494 if (json_last_error() !== JSON_ERROR_NONE) { 1495 return; 1496 } 1497 1498 // Output JSON-LD script 1499 echo '<script type="application/ld+json">' . "\n"; 1500 echo wp_json_encode($schema_data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); 1501 echo "\n" . '</script>' . "\n"; 1502 } 1398 1503 } 1399 1504 -
rank-authority/trunk/readme.txt
r3442843 r3443686 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.0.1 17 Stable tag: 1.0.12 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 136 136 == Changelog == 137 137 138 = 1.0.12 = 139 * Added support for schema parameter in publish and update post endpoints 140 * Added JSON-LD structured data output in wp_head for SEO 141 * Enhanced schema compatibility with multiple SEO plugins (Yoast SEO, Rank Math, All in One SEO) 142 * Improved structured data support for better search engine visibility 143 138 144 = 1.0.11 = 139 145 * Added support for meta_description parameter in publish and update post endpoints … … 207 213 == Upgrade Notice == 208 214 215 = 1.0.12 = 216 Added schema/structured data support - now you can set JSON-LD schema markup via API for better SEO. 217 209 218 = 1.0.11 = 210 219 Added SEO metadata support - now you can set meta descriptions and focus keywords via API.
Note: See TracChangeset
for help on using the changeset viewer.