Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.78k stars 894 forks source link

Identical og_image Values for All Posts in wp-json Endpoint - Potential Bug #21675

Closed yansircc closed 1 month ago

yansircc commented 1 month ago

Description of the issue

In the endpoint http://localhost:10033/wp-json/wp/v2/posts, the og_image values for all posts are identical. I initially thought this was expected behavior, but after checking the endpoint http://localhost:10033/wp-json/wp/v2/posts/$id, I noticed that the og_image is actually the same as the featured image of the specific post. Therefore, I believe this is a bug.

To Reproduce

Step-by-step reproduction instructions

  1. Go to http://localhost:10033/wp-json/wp/v2/posts.
  2. Check the og_image values for all posts.
  3. Go to http://localhost:10033/wp-json/wp/v2/posts/$id for a specific post and compare the og_image with the post's featured image.

Expected results

  1. Each post in the http://localhost:10033/wp-json/wp/v2/posts endpoint should have an og_image that matches its respective featured image.

Actual results

  1. The og_image for all posts in http://localhost:10033/wp-json/wp/v2/posts is the same.

Screenshots, screen recording, code snippet

If possible, please provide a screenshot, screen recording, or code snippet that demonstrates the bug.

Technical info

Used versions

`

wp-core

version: 6.6.2 site_language: en_US user_language: zh_CN timezone: +00:00 permalink: /%postname%/ https_status: false multisite: false user_registration: 0 blog_public: 1 default_comment_status: open environment_type: local user_count: 1 dotorg_communication: true

wp-paths-sizes

wordpress_path: /Users/yansir/Local Sites/nextwp/app/public wordpress_size: 60.35 MB (63286096 bytes) uploads_path: /Users/yansir/Local Sites/nextwp/app/public/wp-content/uploads uploads_size: 13.91 MB (14590239 bytes) themes_path: /Users/yansir/Local Sites/nextwp/app/public/wp-content/themes themes_size: 12.20 MB (12793238 bytes) plugins_path: /Users/yansir/Local Sites/nextwp/app/public/wp-content/plugins plugins_size: 73.52 MB (77094178 bytes) fonts_path: /Users/yansir/Local Sites/nextwp/app/public/wp-content/uploads/fonts fonts_size: directory not found database_size: 3.67 MB (3850240 bytes) total_size: 163.66 MB (171613991 bytes)

wp-active-theme

name: NextWP - Headless WordPress Theme(nextwp-headless-theme-v1.1.2) version: 1.1.2 author: Caleb Barnes author_website: https://github.com/CalebBarnes parent_theme: none theme_features: core-block-patterns, custom-logo, post-thumbnails, menus, widgets-block-editor theme_path: /Users/yansir/Local Sites/nextwp/app/public/wp-content/themes/nextwp-headless-theme-v1.1.2 auto_update: 禁用

wp-themes-inactive (3)

Twenty Twenty-Four: version: 1.2, author: WordPress 团队, 自动更新已禁用 Twenty Twenty-Three: version: 1.5, author: WordPress 团队, 自动更新已禁用 Twenty Twenty-Two: version: 1.8, author: WordPress 团队, 自动更新已禁用

wp-plugins-active (4)

Classic Editor: version: 1.6.4, author: WordPress Contributors (latest version: 1.6.5), 自动更新已禁用 NextWP - Headless Toolkit: version: 1.1.6, author: Caleb Barnes, 自动更新已禁用 Yoast SEO: version: 23.5, author: Team Yoast, 自动更新已禁用 Yoast SEO Premium: version: 23.4, author: Team Yoast, 自动更新已禁用

wp-plugins-inactive (6)

Advanced Custom Fields PRO: version: 6.3.4, author: WP Engine, 自动更新已禁用 Gravity Forms: version: 2.8.17, author: Gravity Forms, 自动更新已启用 JAMstack Deployments: version: 1.1.1, author: Christopher Geary, 自动更新已禁用 On-Demand Revalidation: version: 1.2.4, author: Dexerto, 自动更新已禁用 Rank Math SEO: version: 1.0.228, author: Rank Math, 自动更新已禁用 SEOPress: version: 8.2, author: The SEO Guys at SEOPress, 自动更新已禁用

wp-media

image_editor: WP_Image_Editor_Imagick imagick_module_version: 1808 imagemagick_version: ImageMagick 7.1.0-46 Q16 aarch64 5ef3d4d66:20220816 https://imagemagick.org imagick_version: 3.7.0 file_uploads: 1 post_max_size: 1000M upload_max_filesize: 300M max_effective_size: 300 MB max_file_uploads: 20 imagick_limits: imagick::RESOURCETYPE_AREA: 128 GB imagick::RESOURCETYPE_DISK: 9.2233720368548E+18 imagick::RESOURCETYPE_FILE: 7872 imagick::RESOURCETYPE_MAP: 128 GB imagick::RESOURCETYPE_MEMORY: 64 GB imagick::RESOURCETYPE_THREAD: 1 imagick::RESOURCETYPE_TIME: 9.2233720368548E+18 imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, ASHLAR, AVI, AVIF, AVS, BAYER, BAYERA, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUBE, CUR, CUT, DATA, DCM, DCR, DCRAW, DCX, DDS, DFONT, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FARBFELD, FAX, FF, FILE, FITS, FL32, FLV, FRACTAL, FTP, FTS, FTXT, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, HALD, HDR, HEIC, HEIF, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, JNG, JNX, JPE, JPEG, JPG, JPS, JSON, K25, KDC, KERNEL, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORA, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PHM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PS, PS2, PS3, PSB, PSD, PTIF, PWP, QOI, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGB565, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, STRIMG, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TM2, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X3F, XBM, XC, XCF, XPM, XPS, XV, YAML, YCbCr, YCbCrA, YUV gd_version: bundled (2.1.0 compatible) gd_formats: GIF, JPEG, PNG, WebP, BMP, AVIF ghostscript_version: 9.56.1

wp-server

server_architecture: Darwin 24.0.0 arm64 httpd_software: nginx/1.16.0 php_version: 8.1.29 64bit php_sapi: fpm-fcgi max_input_variables: 4000 time_limit: 1200 memory_limit: 256M max_input_time: 600 upload_max_filesize: 300M php_post_max_size: 1000M curl_version: 8.7.1 (SecureTransport) LibreSSL/3.3.6 suhosin: false imagick_availability: true pretty_permalinks: true htaccess_extra_rules: false current: 2024-10-01T17:19:56+00:00 utc-time: Tuesday, 01-Oct-24 17:19:56 UTC server-time: 2024-10-01T17:19:54+00:00

wp-database

extension: mysqli server_version: 8.0.16 client_version: mysqlnd 8.1.29 max_allowed_packet: 16777216 max_connections: 151

wp-constants

WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /Users/yansir/Local Sites/nextwp/app/public/wp-content WP_PLUGIN_DIR: /Users/yansir/Local Sites/nextwp/app/public/wp-content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: local WP_DEVELOPMENT_MODE: undefined DB_CHARSET: utf8 DB_COLLATE: undefined

wp-filesystem

wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable fonts: not writable

josevarghese commented 1 month ago

Hi @yansircc

Thanks for using the Yoast SEO plugin and for creating the issue. I tried to replicate the issue on my lab site and noticed that the og_image within the REST API endpoint /wp-json/wp/v2/posts is outputted with different image URLs that I had selected for each post as either the featured images or social images.

In case if you are noticing the same image for all posts is outputted as og_image, it would be mostly due to previously stored indexable didn't get cleared, or else you haven't selected any images for the featured image/social image for each post, or else because you are testing on a local environment were the indexable creation is disabled by default. So we recommend you to test it on a live site by selecting the featured image/social image for each post.

You can confirm this by checking this URL to find out that the [og_image is outputted with different image URLs](https://josev156.sg-host.com//wp-json/wp/v2/posts)

We use GitHub exclusively for well-documented bug reports or feature requests. The reported issue does not contain enough information to be a viable bug report or feature request. Thus, we're now closing the report.

We have the following support channels:

If you feel like your bug or enhancement is valid and should be reviewed by us, please use the provided templates, read our contribution guidelines, and submit a new issue.

Thank you for your understanding.