Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 798 forks source link

Jetpack Seo: doesn't support custom post types #38597

Open enejb opened 4 months ago

enejb commented 4 months ago

Impacted plugin

Jetpack

Quick summary

Currently if you have a custom post type you can't use Jetpack SEO to save/update the post meta that need to show up the correct SEO data.

This is due to the meta data now showing up in the editor after you save it.

Steps to reproduce

1.Activate jetpack seo.

  1. install a plugin that adds a new custom post type such as https://nl.wordpress.org/plugins/ultimate-faqs/ on the new FAQ post type editor. Notice that you are able to see the SEO settings but once you set them and save the document. they are removed.

A clear and concise description of what you expected to happen.

The seo setting for the custom post type should be persistant across saves.

What actually happened

The settings disapear after you save them as if you haven't saved them at all.

Impact

All

Available workarounds?

No but the platform is still usable

Platform (Simple and/or Atomic)

Atomic, Self-hosted

Logs or notes

This happends on the latest build of WP and Jetpack. Reported in https://wordpress.org/support/topic/seo-title-and-description-are-empty-but-are-active-on-the-page/

chatoxz-wp commented 4 months ago

I was able to replicate this on self-hosted (Pressable site) and on Atomic (https://testsitechatoxzbusiness.wpcomstaging.com/). The "SEO Description" and "SEO Title" are not saving their content when you publish or try to update.

monsieur-z commented 3 months ago

I haven't been able to figure this out yet. Here's what I've found while trying to troubleshoot it.

Regular Post Custom Post

I don't know what to do with that information, though. Looking at the code of the SEO module, I didn't notice anything that might indicate an issue.

Pinging @Automattic/jetpack-vulcan in case someone has an idea.

jeherve commented 3 months ago

I wonder if it may be worth testing using register_rest_field instead of register_meta to save those values: https://github.com/Automattic/jetpack/blob/77cb43ad1d0042d49b793b4298297e9dd674a484/projects/plugins/jetpack/modules/seo-tools/class-jetpack-seo-posts.php#L177-L179

Reference: https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-responses/#using-register_rest_field-vs-register_meta

monsieur-z commented 3 months ago

Thanks for the advice @jeherve. It didn't seem to make any difference, though.