Created
August 11, 2026 02:02
-
-
Save n7studios/0c0780e13b58f0587aae5f3b17322280 to your computer and use it in GitHub Desktop.
WordPress to Buffer Pro: Remove Alt Text on X/Twitter Images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: WP to Buffer Pro - Disable X Image Alt Text | |
| * Description: Prevents WP to Buffer Pro from sending image alt text with X/Twitter Image-type statuses. | |
| * Version: 1.0.0 | |
| */ | |
| add_filter( | |
| 'wp_to_buffer_pro_publish_build_args', | |
| function ( $args, $post, $profile_id, $service, $status, $action ) { | |
| // Only affect X/Twitter Image-type statuses. | |
| if ( 'twitter' !== $service || 'image' !== $args['post_type'] ) { | |
| return $args; | |
| } | |
| if ( empty( $args['media_urls'] ) || ! is_array( $args['media_urls'] ) ) { | |
| return $args; | |
| } | |
| foreach ( $args['media_urls'] as &$media ) { | |
| if ( is_array( $media ) ) { | |
| $media['alt_text'] = ''; | |
| } | |
| } | |
| unset( $media ); | |
| return $args; | |
| }, | |
| 10, | |
| 6 | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment