Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce 'shortnotes_bypass_post_status_modification' filter. #49

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions includes/share-on-mastodon.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,22 @@ function get_reply_to_id( string $url ): int {
* @return string The modified status text.
*/
function filter_status_text( string $status, \WP_Post $post ): string {
/**
* Filter to bypass modification of default sharing text.
*
* Allows developers to bypass the filtering of a post's status for certain
* post types or other post properties.
*
* @param bool $bypass Whether to bypass the modifying text. Default false.
* @param string $status The default status.
* @param \WP_Post $post The post being shared.
*/
$bypass = apply_filters( 'shortnotes_bypass_post_status_modification', false, $status, $post );

if ( $bypass === true ) {
return $status;
}

$status = Note\transform_content( $post->post_content );

return $status;
Expand Down