jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Publicize: wpas_default_prefix, wpas_default_message, and wpas_default_suffix not working in Gutenberg

Open Malkuthe opened this issue 7 years ago • 8 comments

Steps to reproduce the issue

  1. Install latest WP
  2. Install Jetpack
  3. Activate Publicize module
  4. Connect Twitter account to Jetpack
  5. Install Gutenberg plugin
  6. Install a functional plugin (Code Snippets)
  7. Create a new snippet with the following code in Code Snippets:
function set_new_publicize_default_prefix($msg) {
  return 'prefix-';
}
add_filter('wpas_default_prefix', 'set_new_publicize_default_prefix');

function set_new_publicize_default_msg($msg) {
  return 'default';
}
add_filter('wpas_default_message', 'set_new_publicize_default_msg');

function set_new_publicize_default_suffix($msg) {
  return '-suffix';
}
add_filter('wpas_default_suffix', 'set_new_publicize_default_suffix');
  1. Save & Activate code snippet
  2. Create new post with Gutenberg (use any title)
  3. Attempt to publish post

What I expected

I expected to see, in the "Customize your Message" text area, under "Share This Post" in the "Publish Settings" dialog of Gutenberg, the text prefix-default-suffix.

What happened instead

What I see in the "Customize your Message" area is the title of the post, instead.

Screenshots image

Malkuthe avatar Dec 04 '18 20:12 Malkuthe

Thanks for your contribution. I'll transfer this issue to the wp-calypso repository, where the Publicize integration is being built.

jeherve avatar Dec 05 '18 09:12 jeherve

I would love to use a suffix so I can enable automatic hashtags on Twitter (for a local news site: news and location). Are any updates to this issue? Is there anything I can do (as a non-coder, though)? Thanks!

HansVanEijsden avatar Aug 26 '19 13:08 HansVanEijsden

Hashtag support Requested in 2954721-zen

interlineae avatar May 11 '20 06:05 interlineae

Is there any update on this? At the very least, if it's not going to be fixed you ought to update the documentation as it still tells you these should work: https://developer.jetpack.com/hooks/wpas_default_message/

Ipstenu avatar Sep 27 '20 17:09 Ipstenu

At least in part, we can explore applying filters when setting the post REST API rest field: https://github.com/Automattic/jetpack/blob/master/projects/plugins/jetpack/modules/publicize/publicize.php#L874

Unknown: How do we ensure we're using the title? If the post hasn't been saved or the post title is edited, we can't pass the title (or at least rely on it). How do we dynamically handle this? Can we use this one field or do we need a few different fields and let the JS on the Gutenberg side put it together?

kraftbj avatar May 04 '21 22:05 kraftbj

Assuming this is related, but I noticed that using emojis in the custom text causes this error:

Publishing failed. Could not update the meta value of _wpas_mess in database.

slambert avatar Aug 12 '21 01:08 slambert

Huh. I never made the connection to emoji's being an issue, but I got annoyed tonight while trying to schedule a post and found this issue. Can confirm @slambert that removing the emoji fixes it. Some kind of silly collation issue I assume but it's a shame no feedback on this for a couple of years.

ryanbooz avatar Mar 15 '23 22:03 ryanbooz

Support References

This comment is automatically generated. Please do not edit it.

  • [ ] 2954721-zen

github-actions[bot] avatar Mar 15 '23 22:03 github-actions[bot]