Changeset 3436300
- Timestamp:
- 01/09/2026 09:05:06 PM (3 months ago)
- Location:
- add-wpgraphql-seo
- Files:
-
- 2 added
- 14 edited
- 1 copied
-
tags/5.0.1 (copied) (copied from add-wpgraphql-seo/trunk)
-
tags/5.0.1/.husky/pre-commit (modified) (1 diff)
-
tags/5.0.1/CHANGELOG.md (modified) (1 diff)
-
tags/5.0.1/includes/helpers/functions.php (modified) (2 diffs)
-
tags/5.0.1/includes/resolvers/post-type.php (modified) (1 diff)
-
tags/5.0.1/package.json (modified) (2 diffs)
-
tags/5.0.1/pnpm-lock.yaml (added)
-
tags/5.0.1/readme.txt (modified) (1 diff)
-
tags/5.0.1/wp-graphql-yoast-seo.php (modified) (1 diff)
-
trunk/.husky/pre-commit (modified) (1 diff)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/includes/helpers/functions.php (modified) (2 diffs)
-
trunk/includes/resolvers/post-type.php (modified) (1 diff)
-
trunk/package.json (modified) (2 diffs)
-
trunk/pnpm-lock.yaml (added)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/wp-graphql-yoast-seo.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
add-wpgraphql-seo/tags/5.0.1/.husky/pre-commit
r2740469 r3436300 2 2 . "$(dirname -- "$0")/_/husky.sh" 3 3 4 yarnprettier4 pnpm prettier -
add-wpgraphql-seo/tags/5.0.1/CHANGELOG.md
r3364564 r3436300 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## [5.0.1] - 2026-01-09 9 10 ### Fixed 11 12 - Fix naming collision with vip-helpers plugin (#191) (thanks @amanda-t) 13 14 ### Fixed 15 16 - Fix undefined function error 7 17 8 18 ## [5.0.0] - 2025-04-26 -
add-wpgraphql-seo/tags/5.0.1/includes/helpers/functions.php
r3364564 r3436300 65 65 return $image['id']; 66 66 } 67 return wp com_vip_attachment_url_to_postid($url);67 return wp_gql_seo_attachment_url_to_postid($url); 68 68 } 69 69 … … 86 86 /** 87 87 * Generate cache key for attachment URL. 88 * Only declare if not already defined (e.g., by VIP platform). 88 89 * 89 90 * @param string $url URL to generate cache key for. 90 91 * @return string 91 92 */ 92 function wpcom_vip_attachment_cache_key($url) 93 { 94 return 'wpcom_vip_attachment_url_post_id_' . md5($url); 93 if (!function_exists('wpcom_vip_attachment_cache_key')) { 94 function wpcom_vip_attachment_cache_key($url) 95 { 96 return 'wpcom_vip_attachment_url_post_id_' . md5($url); 97 } 95 98 } 96 99 97 100 /** 98 101 * Get post ID from attachment URL with caching. 102 * Only declare if not already defined (e.g., by VIP platform). 99 103 * 100 104 * @param string $url URL to get post ID for. 101 105 * @return int|null 102 106 */ 103 function wpcom_vip_attachment_url_to_postid($url) 104 { 105 $cache_key = wpcom_vip_attachment_cache_key($url); 106 $id = wp_cache_get($cache_key); 107 if (false === $id) { 108 $id = attachment_url_to_postid($url); // phpcs:ignore 109 if (empty($id)) { 110 wp_cache_set( 111 $cache_key, 112 'not_found', 113 'default', 114 12 * HOUR_IN_SECONDS + mt_rand(0, 4 * HOUR_IN_SECONDS) // phpcs:ignore 115 ); 116 $id = null; // Set $id to null instead of false 117 } else { 118 wp_cache_set( 119 $cache_key, 120 $id, 121 'default', 122 24 * HOUR_IN_SECONDS + mt_rand(0, 12 * HOUR_IN_SECONDS) // phpcs:ignore 123 ); 124 } 125 } elseif ('not_found' === $id) { 126 return null; // Return null instead of false 127 } 128 129 return $id; 107 if (!function_exists('wpcom_vip_attachment_url_to_postid')) { 108 function wpcom_vip_attachment_url_to_postid($url) 109 { 110 $cache_key = wpcom_vip_attachment_cache_key($url); 111 $id = wp_cache_get($cache_key); 112 if (false === $id) { 113 $id = attachment_url_to_postid($url); // phpcs:ignore 114 if (empty($id)) { 115 wp_cache_set( 116 $cache_key, 117 'not_found', 118 'default', 119 12 * HOUR_IN_SECONDS + mt_rand(0, 4 * HOUR_IN_SECONDS) // phpcs:ignore 120 ); 121 $id = null; // Set $id to null instead of false 122 } else { 123 wp_cache_set( 124 $cache_key, 125 $id, 126 'default', 127 24 * HOUR_IN_SECONDS + mt_rand(0, 12 * HOUR_IN_SECONDS) // phpcs:ignore 128 ); 129 } 130 } elseif ('not_found' === $id) { 131 return false; 132 } 133 134 return $id; 135 } 136 } 137 138 /** 139 * Wrapper for wpcom_vip_attachment_url_to_postid that returns null instead of false. 140 * This is needed for GraphQL compatibility - fixes 141 * "Cannot return null for non-nullable field 'MediaItem.id'" errors. 142 * 143 * @see https://github.com/ashhitch/wp-graphql-yoast-seo/issues/132 144 * @param string $url URL to get post ID for. 145 * @return int|null 146 */ 147 function wp_gql_seo_attachment_url_to_postid($url) 148 { 149 $id = wpcom_vip_attachment_url_to_postid($url); 150 return (false === $id || empty($id)) ? null : $id; 130 151 } 131 152 -
add-wpgraphql-seo/tags/5.0.1/includes/resolvers/post-type.php
r3364564 r3436300 74 74 } 75 75 76 $id = wp com_vip_attachment_url_to_postid($twitter_image);76 $id = wp_gql_seo_attachment_url_to_postid($twitter_image); 77 77 78 78 return $context->get_loader('post')->load_deferred(absint($id)); -
add-wpgraphql-seo/tags/5.0.1/package.json
r3364564 r3436300 1 1 { 2 2 "name": "wp-graphql-yoast-seo", 3 "version": "v5.0. 0",3 "version": "v5.0.1", 4 4 "description": "A WPGraphQL Extension that adds support for Yoast SEO", 5 5 "scripts": { … … 18 18 "homepage": "https://github.com/ashhitch/wp-graphql-yoast-seo#readme", 19 19 "devDependencies": { 20 "@prettier/plugin-php": "^0.2 2.4",20 "@prettier/plugin-php": "^0.24.0", 21 21 "husky": ">=8.0.1", 22 22 "lint-staged": ">=13.0.1", 23 "prettier": "^ 2.6.2"23 "prettier": "^3.7.4" 24 24 } 25 25 } -
add-wpgraphql-seo/tags/5.0.1/readme.txt
r3364564 r3436300 3 3 Tags: SEO, Yoast, WPGraphQL, GraphQL, Headless WordPress 4 4 Requires at least: 5.0 5 Tested up to: 6. 85 Tested up to: 6.9 6 6 Requires PHP: 7.1 7 Stable tag: 5.0. 07 Stable tag: 5.0.1 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html -
add-wpgraphql-seo/tags/5.0.1/wp-graphql-yoast-seo.php
r3364564 r3436300 9 9 * Text Domain: wp-graphql-yoast-seo 10 10 * Domain Path: /languages 11 * Version: v5.0. 011 * Version: v5.0.1 12 12 * Requires Plugins: wp-graphql, wordpress-seo 13 13 * -
add-wpgraphql-seo/trunk/.husky/pre-commit
r2740469 r3436300 2 2 . "$(dirname -- "$0")/_/husky.sh" 3 3 4 yarnprettier4 pnpm prettier -
add-wpgraphql-seo/trunk/CHANGELOG.md
r3364564 r3436300 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## [5.0.1] - 2026-01-09 9 10 ### Fixed 11 12 - Fix naming collision with vip-helpers plugin (#191) (thanks @amanda-t) 13 14 ### Fixed 15 16 - Fix undefined function error 7 17 8 18 ## [5.0.0] - 2025-04-26 -
add-wpgraphql-seo/trunk/includes/helpers/functions.php
r3364564 r3436300 65 65 return $image['id']; 66 66 } 67 return wp com_vip_attachment_url_to_postid($url);67 return wp_gql_seo_attachment_url_to_postid($url); 68 68 } 69 69 … … 86 86 /** 87 87 * Generate cache key for attachment URL. 88 * Only declare if not already defined (e.g., by VIP platform). 88 89 * 89 90 * @param string $url URL to generate cache key for. 90 91 * @return string 91 92 */ 92 function wpcom_vip_attachment_cache_key($url) 93 { 94 return 'wpcom_vip_attachment_url_post_id_' . md5($url); 93 if (!function_exists('wpcom_vip_attachment_cache_key')) { 94 function wpcom_vip_attachment_cache_key($url) 95 { 96 return 'wpcom_vip_attachment_url_post_id_' . md5($url); 97 } 95 98 } 96 99 97 100 /** 98 101 * Get post ID from attachment URL with caching. 102 * Only declare if not already defined (e.g., by VIP platform). 99 103 * 100 104 * @param string $url URL to get post ID for. 101 105 * @return int|null 102 106 */ 103 function wpcom_vip_attachment_url_to_postid($url) 104 { 105 $cache_key = wpcom_vip_attachment_cache_key($url); 106 $id = wp_cache_get($cache_key); 107 if (false === $id) { 108 $id = attachment_url_to_postid($url); // phpcs:ignore 109 if (empty($id)) { 110 wp_cache_set( 111 $cache_key, 112 'not_found', 113 'default', 114 12 * HOUR_IN_SECONDS + mt_rand(0, 4 * HOUR_IN_SECONDS) // phpcs:ignore 115 ); 116 $id = null; // Set $id to null instead of false 117 } else { 118 wp_cache_set( 119 $cache_key, 120 $id, 121 'default', 122 24 * HOUR_IN_SECONDS + mt_rand(0, 12 * HOUR_IN_SECONDS) // phpcs:ignore 123 ); 124 } 125 } elseif ('not_found' === $id) { 126 return null; // Return null instead of false 127 } 128 129 return $id; 107 if (!function_exists('wpcom_vip_attachment_url_to_postid')) { 108 function wpcom_vip_attachment_url_to_postid($url) 109 { 110 $cache_key = wpcom_vip_attachment_cache_key($url); 111 $id = wp_cache_get($cache_key); 112 if (false === $id) { 113 $id = attachment_url_to_postid($url); // phpcs:ignore 114 if (empty($id)) { 115 wp_cache_set( 116 $cache_key, 117 'not_found', 118 'default', 119 12 * HOUR_IN_SECONDS + mt_rand(0, 4 * HOUR_IN_SECONDS) // phpcs:ignore 120 ); 121 $id = null; // Set $id to null instead of false 122 } else { 123 wp_cache_set( 124 $cache_key, 125 $id, 126 'default', 127 24 * HOUR_IN_SECONDS + mt_rand(0, 12 * HOUR_IN_SECONDS) // phpcs:ignore 128 ); 129 } 130 } elseif ('not_found' === $id) { 131 return false; 132 } 133 134 return $id; 135 } 136 } 137 138 /** 139 * Wrapper for wpcom_vip_attachment_url_to_postid that returns null instead of false. 140 * This is needed for GraphQL compatibility - fixes 141 * "Cannot return null for non-nullable field 'MediaItem.id'" errors. 142 * 143 * @see https://github.com/ashhitch/wp-graphql-yoast-seo/issues/132 144 * @param string $url URL to get post ID for. 145 * @return int|null 146 */ 147 function wp_gql_seo_attachment_url_to_postid($url) 148 { 149 $id = wpcom_vip_attachment_url_to_postid($url); 150 return (false === $id || empty($id)) ? null : $id; 130 151 } 131 152 -
add-wpgraphql-seo/trunk/includes/resolvers/post-type.php
r3364564 r3436300 74 74 } 75 75 76 $id = wp com_vip_attachment_url_to_postid($twitter_image);76 $id = wp_gql_seo_attachment_url_to_postid($twitter_image); 77 77 78 78 return $context->get_loader('post')->load_deferred(absint($id)); -
add-wpgraphql-seo/trunk/package.json
r3364564 r3436300 1 1 { 2 2 "name": "wp-graphql-yoast-seo", 3 "version": "v5.0. 0",3 "version": "v5.0.1", 4 4 "description": "A WPGraphQL Extension that adds support for Yoast SEO", 5 5 "scripts": { … … 18 18 "homepage": "https://github.com/ashhitch/wp-graphql-yoast-seo#readme", 19 19 "devDependencies": { 20 "@prettier/plugin-php": "^0.2 2.4",20 "@prettier/plugin-php": "^0.24.0", 21 21 "husky": ">=8.0.1", 22 22 "lint-staged": ">=13.0.1", 23 "prettier": "^ 2.6.2"23 "prettier": "^3.7.4" 24 24 } 25 25 } -
add-wpgraphql-seo/trunk/readme.txt
r3364564 r3436300 3 3 Tags: SEO, Yoast, WPGraphQL, GraphQL, Headless WordPress 4 4 Requires at least: 5.0 5 Tested up to: 6. 85 Tested up to: 6.9 6 6 Requires PHP: 7.1 7 Stable tag: 5.0. 07 Stable tag: 5.0.1 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html -
add-wpgraphql-seo/trunk/wp-graphql-yoast-seo.php
r3364564 r3436300 9 9 * Text Domain: wp-graphql-yoast-seo 10 10 * Domain Path: /languages 11 * Version: v5.0. 011 * Version: v5.0.1 12 12 * Requires Plugins: wp-graphql, wordpress-seo 13 13 *
Note: See TracChangeset
for help on using the changeset viewer.