Automattic / Automattic/jetpack

Publicize default message filters have no effect when used in a theme's functions.php

Open
#3,797 17 comments 0 reactions 0 assignees View on GitHub
[Feature] Publicize [Pri] Low Bug Good For Community
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

#### What I expected

Using the `wpas_default_message`, `wpas_default_prefix`, and `wpas_default_suffix` filters should allow anyone to dynamically modify the relevant portion of the default Publicize message.
#### What happened instead

Using any of those filters has no effect on the default Publicize message. Changing the filter priorities has no effect. The only technique that worked was to modify the default values in source files (not a tenable solution).
#### Steps to reproduce the issue
1. Install latest WP
2. Install Jetpack
3. Settings -> Permalinks -> Post name -> Save Changes
4. Activate Publicize module
5. Connect Twitter account to Jetpack
6. Add these filter functions to the end of the twentysixteen `functions.php` file:

``` php
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');
```
7. Create a new post with title "Lorem Ipsum" (blank content)
8. Publish post
9. Expected Tweet = "prefix-default-suffix"; actual Tweet is the post title + URL

Contributor guide

Open the contributing guide

Research direction

Start by tracing the wpas_default_message, wpas_default_prefix, and wpas_default_suffix filter registrations and the code that builds the default Publicize message. Reproduce the issue using the listed WordPress, Jetpack, Publicize, and Twitter steps; done means the filters produce the expected "prefix-default-suffix" Tweet.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.