Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress to Buffer Pro: Change value of {url}
<?php
/**
* Plugin Name: WP to Buffer Pro: Change URL
* Plugin URI: http://www.wpzinc.com/plugins/wp-to-buffer-pro
* Version: 1.0.0
* Author: WP Zinc
* Author URI: http://www.wpzinc.com
* Description: Changes the {url} from your Post's URL to something else. Change code in this Plugin as necessary to define the URL you want.
*/
/**
* Change the URL in the Status Message's Text, before it is sent to Buffer
*
* @since 1.0.0
*
* @param array $args Buffer Status Message Arguments
* @param WP_Post $post WordPress Post to share
* @param string $profile_id Buffer Profile ID
* @param string $service Social Media Service the Profile ID belongs to
* @param string $status Post Status (publish or update)
* @return array Buffer Status Message Arguments
*/
function wp_to_buffer_pro_change_url( $args, $post, $profile_id, $service, $status ) {
// Define the URL you want to use instead
$new_url = 'https://www.wpzinc.com';
// Stop editing
// You shouldn't need to modify anything from here
$args['text'] = str_replace( get_bloginfo( 'url' ), $new_url, $args['text'] );
return $args;
}
add_filter( 'wp_to_buffer_pro_publish_build_args', 'wp_to_buffer_pro_change_url', 10, 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.